From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
Pavel Machek <pavel@ucw.cz>,
kernel list <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Lutomirski <luto@kernel.org>,
Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>,
Denys Vlasenko <dvlasenk@redhat.com>, Peter Anvin <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: v4.10: kernel stack frame pointer .. has bad value (null)
Date: Wed, 8 Mar 2017 11:37:03 -0600 [thread overview]
Message-ID: <20170308173703.2h57rsltma3smbcm@treble> (raw)
In-Reply-To: <CA+55aFyjEuRLN6PMZZqi6k0rA6=AsTTZeN37eyyJM5ig-mnM4w@mail.gmail.com>
On Tue, Mar 07, 2017 at 10:40:14AM -0800, Linus Torvalds wrote:
> On Tue, Mar 7, 2017 at 10:28 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > Also, the gcc documentation says -maccumulate-outgoing-args is
> > "generally beneficial for performance and size."
>
> Hmm. I wonder how true that is. I'm pretty sure it generates bigger
> code, although it's probably less noticeable in the kernel (as opposed
> to the traditional x86 "push everything" model) due to having the
> three register arguments.
It does seem to make it bigger. With Pavel's config on gcc 6, if I add
-maccumulate-outgoing-args:
text data bss dec hex filename
12692555 5550652 9146368 27389575 1a1ee87 vmlinux.before
13179531 5546556 9146368 27872455 1a94cc7 vmlinux.after
That's 3.8% more text on x86-32.
(FWIW, on x86-64, the size difference is negligible.)
> And the "it's faster" is almost certainly garbage. It's true on P4 and
> some older AMD cores that couldn't do push/pops quickly.
>
> > Not to mention the fact that -maccumulate-outgoing-args seems to already
> > be enabled in most cases anyway.
>
> Yeah, that's the main argument for this patch, I think - just remove
> the (unusual) special case.
As it turns out, when optimizing for size, gcc seems to ignore
-maccumulate-outgoing-args completely. So I guess we would have to live
with both cases anyway. Which means I'll need to make the unwinder
smart enough to deal with it.
But that brings up another question. If -maccumulate-outgoing-args is
ignored with CONFIG_CC_OPTIMIZE_FOR_SIZE=y, wouldn't using that option
break the things which require -maccumulate-outgoing-args?
So, looking deeper at the various reasons this flag is enabled, they
seem to be mostly obsolete.
- 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.
- CONFIG_JUMP_LABEL sets it on x86-32 because of a bug in gcc <= 4.5.1
which has since been fixed with
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226. We could probably
make it gcc-version-dependent.
- x86-64 sets it to apparently make the no-longer-in-tree DWARF unwinder
happy with older versions of gcc.
So it looks like -maccumulate-outgoing-args isn't actually needed in
most cases.
--
Josh
next prev parent reply other threads:[~2017-03-08 17:45 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 22:14 v4.10: kernel stack frame pointer .. has bad value (null) Pavel Machek
2017-02-21 23:12 ` Josh Poimboeuf
2017-02-21 23:15 ` H. Peter Anvin
2017-02-22 16:45 ` Josh Poimboeuf
2017-02-22 20:51 ` H. Peter Anvin
2017-02-22 21:15 ` Josh Poimboeuf
2017-02-22 21:05 ` Pavel Machek
2017-02-22 21:21 ` Josh Poimboeuf
2017-02-22 22:47 ` Pavel Machek
2017-02-22 22:56 ` Josh Poimboeuf
2017-02-22 23:18 ` Josh Poimboeuf
2017-02-23 20:10 ` Pavel Machek
2017-02-25 5:04 ` Josh Poimboeuf
2017-03-02 23:45 ` Josh Poimboeuf
2017-03-06 16:38 ` Pavel Machek
2017-03-07 17:38 ` Josh Poimboeuf
2017-03-07 17:52 ` Linus Torvalds
2017-03-07 17:59 ` Andy Lutomirski
2017-03-07 18:28 ` Josh Poimboeuf
2017-03-07 18:30 ` Josh Poimboeuf
2017-03-07 18:40 ` Linus Torvalds
2017-03-08 17:37 ` Josh Poimboeuf [this message]
2017-03-08 18:25 ` Linus Torvalds
2017-03-08 18:54 ` Andy Lutomirski
2017-03-08 21:22 ` Pavel Machek
2017-03-09 9:38 ` Geert Uytterhoeven
2017-03-09 10:56 ` Pavel Machek
2017-03-09 12:16 ` Geert Uytterhoeven
2017-03-10 13:17 ` Compiling kernels faster (was Re: v4.10: kernel stack frame pointer .. has bad value (null)) Pavel Machek
2017-03-10 13:28 ` Geert Uytterhoeven
2017-03-10 14:15 ` Willy Tarreau
2017-03-09 10:49 ` Old compiler versions " Pavel Machek
2017-03-09 18:05 ` Linus Torvalds
2017-03-09 15:29 ` v4.10: kernel stack frame pointer .. has bad value (null) Peter Zijlstra
2017-03-09 21:12 ` Pavel Machek
2017-03-08 21:29 ` Josh Poimboeuf
2017-03-09 14:14 ` Steven Rostedt
2017-03-09 18:31 ` Josh Poimboeuf
2017-03-16 15:42 ` [PATCH] x86: mostly disable '-maccumulate-outgoing-args' Josh Poimboeuf
2017-03-16 17:32 ` Steven Rostedt
2017-03-16 18:36 ` Josh Poimboeuf
2017-03-16 18:53 ` Josh Poimboeuf
2017-03-16 19:04 ` Josh Poimboeuf
2017-03-16 19:07 ` Steven Rostedt
2017-03-16 19:06 ` Steven Rostedt
2017-03-16 19:31 ` [PATCH v2] " Josh Poimboeuf
2017-03-22 7:51 ` Ingo Molnar
2017-03-22 15:48 ` Josh Poimboeuf
2017-03-28 8:13 ` [tip:x86/urgent] x86/build: Mostly " tip-bot for Josh Poimboeuf
2017-03-28 16:17 ` Josh Poimboeuf
2017-03-30 9:58 ` tip-bot for Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170308173703.2h57rsltma3smbcm@treble \
--to=jpoimboe@redhat.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox