Re: CONFIG_FRAME_POINTER [was [PATCH] x86: BUILD_IRQ say .text]

From: Ingo Molnar
Date: Mon Jul 28 2008 - 10:42:19 EST



* Hugh Dickins <hugh@xxxxxxxxxxx> wrote:

> [PATCH] sched: move sched_clock before first use
>
> Move sched_clock() up to stop warning: weak declaration of
> `sched_clock' after first use results in unspecified behavior (if
> -fno-unit-at-a-time).
>
> Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>

applied to tip/sched/urgent - thanks Hugh.

> I rather think CONFIG_FRAME_POINTER shouldn't exist at all (or be a
> private, config-user-invisible, specific-to-a-few-arches thing): what
> one wants to configure is how far to sacrifice cpu performance and
> kernel smallness to getting a good stacktrace. Frame pointer is just
> an implementation detail on that, appropriate to some arches. Perhaps
> three settings: no stacktrace, fair stacktrace, best stacktrace.

actually, we consciously use and rely on frame pointers on x86. The
runtime cost on 64-bit is miniscule and the improved backtrace output in
recent kernels makes backtraces _much_ easier to interpret:

Call Trace:
<NMI> [<ffffffff80480779>] _raw_spin_trylock+0x19/0x50
[<ffffffff808fb2e9>] _spin_lock_irqsave+0x59/0x90
[<ffffffff80261ab4>] atomic_notifier_chain_register+0x24/0x60
[<ffffffff80262f38>] ? __profile_tick+0x58/0x90
[<ffffffff808fd1a9>] nmi_watchdog_tick+0x59/0x1e0
[<ffffffff808fc79a>] default_do_nmi+0x6a/0x220
[<ffffffff808fc9b4>] do_nmi+0x64/0xb0
[<ffffffff808fc032>] nmi+0xa2/0xc2
[<ffffffff80285bd1>] ? stopmachine+0x61/0xd0
<<EOE>> [<ffffffff8020dca9>] child_rip+0xa/0x11
[<ffffffff8020cf3e>] ? restore_args+0x0/0x30
[<ffffffff80285b70>] ? stopmachine+0x0/0xd0
[<ffffffff8020dc9f>] ? child_rip+0x0/0x11

we experimented with using dwarf2 data in the past but it proved to be
very fragile in practice - we depended too much on the whims of
gcc/binutils being absolutely correct, etc.

Something as fundamental to the kernel's general health as backtraces
must not be fragile. So the EBP based backtracing code was ported to
64-bit as well and it was improved further upon.

kudos to Arjan for that.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/