Re: v4.10: kernel stack frame pointer .. has bad value (null)
From: Josh Poimboeuf
Date: Thu Mar 09 2017 - 13:31:31 EST
On Thu, Mar 09, 2017 at 09:14:47AM -0500, Steven Rostedt wrote:
> On Wed, 8 Mar 2017 15:29:59 -0600
> Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> > [adding Steven Rostedt to CC as an FYI]
> >
> > On Wed, Mar 08, 2017 at 10:25:01AM -0800, Linus Torvalds wrote:
> > > On Wed, Mar 8, 2017 at 9:37 AM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> > > > - CONFIG_FUNCTION_GRAPH_TRACER sets it on x86-32 because of a gcc bug
> > > > where the stack gets aligned before the mcount call. This issue
> > > > should be mostly obsolete as most modern compilers now have -mfentry.
> > > > We could make it dependent on CC_USING_FENTRY.
> > >
> > > Yeah. At some point we might even upgrade the compiler requirements to
> > > no longer accept the mcount model.
> >
> > The plot slightly thickens...
> >
> > So I was mistaken about this problem not existing with newer versions of
> > gcc, because the x86-32 ftrace code doesn't use -mfentry. It still
> > relies on mcount. So CONFIG_FUNCTION_GRAPH_TRACER will still need
> > -maccumulate-outgoing-args for *all* versions of gcc on x86-32.
>
> OK, I admit, I was lazy here. I thought, who cares about x86-32
> anymore ;-)
As we just saw in another thread where somebody ran into this problem
with -Os, apparently some people still do care...
> > (Of course, that situation would improve if ftrace on x86-32 were ported
> > to use -mfentry.)
>
> That can easily be done.
You weren't on CC earlier, so just to summarize the benefits of doing
fentry on x86-32, thus removing the need for -maccumulate-outgoing-args:
- graph tracer compatibility with -Os
- text size decrease of ~3%
- possible performance improvement
- more uniformity (-maccumulate-outgoing-args disabled everywhere for
modern gccs)
But either way I'll still work up a patch to make the changes I
suggested.
--
Josh