[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181004094519.GA97692@gmail.com>
Date: Thu, 4 Oct 2018 11:45:19 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Nadav Amit <namit@...are.com>
Cc: "hpa@...or.com" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Jan Beulich <JBeulich@...e.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions
* Nadav Amit <namit@...are.com> wrote:
> > Another, separate question I wanted to ask: how do we ensure that the kernel stays fixed?
> > I.e. is there some tooling we can use to actually measure whether there's bad inlining decisions
> > done, to detect all these bad patterns that cause bad GCC code generation?
>
> Good question. First, I’ll indicate that this patch-set does not handle all
> the issues. There is still the issue of conditional use of
> __builtin_constant_p().
>
> One indication for bad inlining decisions is the inlined functions have
> multiple (non-inlined) instances in the binary and are short. I don’t
> have an automatic solution, but you can try, for example to run:
>
> nm --print-size ./vmlinux | grep ' t ' | cut -d' ' -f2- | sort | uniq -c | \
> grep -v '^ 1' | sort -n -r | head -n 5
>
> There are however many false positives. After these patches, for example, I
> get:
>
> 11 000000000000012f t jhash
> 7 0000000000000017 t dst_output
> 6 0000000000000011 t kzalloc
> 5 000000000000002f t acpi_os_allocate_zeroed
> 5 0000000000000029 t acpi_os_allocate
>
>
> jhash() should not have been inlined in my mind, and should have a
> non-inlined implementation. dst_output() is used as a function pointer.
> kzalloc() and the next two suffer from the __builtin_constant_p() problem I
> described in the past.
Ok, that's useful info.
The histogram suggests that with all your patches applied the kernel is now in a pretty good
state in terms of inlining decisions, right?
Are you using defconfig or a reasonable distro-config for your tests?
Thanks,
Ingo
Powered by blists - more mailing lists