* Josh Poimboeuf <jpoim...@redhat.com> wrote:

> On Mon, Jul 20, 2015 at 08:30:52AM -0700, Andy Lutomirski wrote:
> > On Fri, Jul 17, 2015 at 8:56 PM, Josh Poimboeuf <jpoim...@redhat.com> wrote:
> > > The reason I suggested to put FRAME in the macro name is to try to
> > > prevent it from being accidentally used for leaf functions, where it
> > > isn't needed.
> > >
> > 
> > Could someone remind me why it isn't needed for leaf functions?
> 
> If a function doesn't call any other functions, then it won't ever show
> up in a stack trace unless:
> 
> a) the function itself walks the stack, in which case the frame pointer
>    isn't necessary; or
> 
> b) The function gets hit by an interrupt/exception, in which case frame
>    pointers can't be 100% relied upon anyway.
> 
> I've noticed that gcc *does* seem to create stack frames for leaf functions.  
> But it's inconsistent, because the early exit path of some functions will 
> skip 
> the stack frame creation and go straight to the return.
> 
> We could probably get a good performance boost with the 
> -momit-leaf-frame-pointer flag.  Though it would make stack traces less 
> reliable 
> when a leaf function gets interrupted.

So in theory we could resolve this during the stack walk: when we pass from the 
IRQ stack to the process stack we actually know the RIP of the interrupted 
context, and could include that.

Visualizing context boundaries in the stack dump would also be pretty useful 
independently of the performance boost. We already demark them to a certain 
degree:

[   37.287036] Call Trace:
[   37.287042]  <IRQ>  [<ffffffffb5161eee>] dump_stack+0x4c/0x65
[   37.287045]  [<ffffffffb3d40288>] ? down_trylock+0x28/0x33
[   37.287048]  [<ffffffffb3cfa74d>] warn_slowpath_common+0x7b/0xb1
[   37.287050]  [<ffffffffb3cfa7f7>] warn_slowpath_fmt+0x50/0x6e
[   37.287053]  [<ffffffffb3cfe0ba>] ? __do_softirq+0x224/0x289
[   37.287055]  [<ffffffffb3cfe047>] ? __do_softirq+0x1b1/0x289
[   37.287057]  [<ffffffffb3d71b4c>] can_stop_full_tick+0x69/0xa1
[   37.287059]  [<ffffffffb3d72273>] tick_nohz_irq_exit+0x72/0x98
[   37.287061]  [<ffffffffb3cfe3b5>] irq_exit+0xbf/0x104
[   37.287064]  [<ffffffffb3c6b01a>] smp_apic_timer_interrupt+0x42/0x51
[   37.287067]  [<ffffffffb51821d9>] apic_timer_interrupt+0x89/0x90
[   37.287071]  <EOI>  [<ffffffffb3d283ab>] ? ___might_sleep+0x150/0x232
[   37.287075]  [<ffffffffb3d4b684>] ? lock_torture_reader+0x102/0x102

including the RIP of interrupted nested contexts would be helpful.

Thanks,

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

Reply via email to