From: Josh Triplett <josh@joshtriplett.org>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: linux-kernel@vger.kernel.org, Christopher Li <sparse@chrisli.org>,
linux-sparse@vger.kernel.org
Subject: Re: [RFC 1/8] x86: objtool: use asm macro for better compiler decisions
Date: Tue, 15 May 2018 14:55:41 -0700 [thread overview]
Message-ID: <20180515215540.GB7298@localhost> (raw)
In-Reply-To: <4E72C06C-7A4B-4E18-83DA-8E0C9F701854@gmail.com>
On Tue, May 15, 2018 at 02:53:52PM -0700, Nadav Amit wrote:
> Josh Triplett <josh@joshtriplett.org> wrote:
>
> > On Tue, May 15, 2018 at 07:11:08AM -0700, Nadav Amit wrote:
> >> GCC considers the number of statements in inlined assembly blocks,
> >> according to new-lines and semicolons, as an indication to the cost of
> >> the block in time and space. This data is distorted by the kernel code,
> >> which puts information in alternative sections. As a result, the
> >> compiler may perform incorrect inlining and branch optimizations.
> >>
> >> In the case of objtool, this distortion is extreme, since anyhow the
> >> annotations of objtool are discarded during linkage.
> >>
> >> The solution is to set an assembly macro and call it from the inlinedv
> >> assembly block. As a result GCC considers the inline assembly block as
> >> a single instruction.
> >>
> >> This patch slightly increases the kernel size.
> >>
> >> text data bss dec hex filename
> >> 18126699 10066728 2936832 31130259 1db0293 ./vmlinux before
> >> 18126824 10067268 2936832 31130924 1db052c ./vmlinux after (+665)
> >
> > With what kernel config? What's the text size change for an allnoconfig?
>
> I use my custom config and to include the drivers in the image. Other
> configs were not too appropriate: defconfig does not enable paravirt and
> allyesconfig is too heavy.
>
> There is no effect with allnoconfig on size:
>
> text data bss dec hex filename
> 1018441 230148 1215604 2464193 2599c1 ./vmlinux
> 1018441 230148 1215604 2464193 2599c1 ./vmlinux
>
> I think it is expected since CONFIG_STACK_VALIDATION is off. No?
Thanks for checking; fine by me then. :)
next prev parent reply other threads:[~2018-05-15 21:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 14:11 [RFC 0/8] Improving compiler inlining decisions Nadav Amit
2018-05-15 14:11 ` [RFC 1/8] x86: objtool: use asm macro for better compiler decisions Nadav Amit
2018-05-15 21:37 ` Josh Triplett
2018-05-15 21:53 ` Nadav Amit
2018-05-15 21:55 ` Josh Triplett [this message]
2018-05-15 14:11 ` [RFC 0/8] Improving compiler inlining decisions Nadav Amit
2018-05-15 14:11 ` [RFC 1/8] x86: objtool: use asm macro for better compiler decisions Nadav Amit
2018-05-15 22:14 ` [RFC 0/8] Improving compiler inlining decisions Nadav Amit
2018-05-16 3:48 ` Josh Poimboeuf
2018-05-16 4:30 ` Nadav Amit
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=20180515215540.GB7298@localhost \
--to=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=nadav.amit@gmail.com \
--cc=sparse@chrisli.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;
as well as URLs for NNTP newsgroup(s).