Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-27 Thread Arnd Bergmann
On Fri, Feb 26, 2021 at 2:24 PM Arnd Bergmann wrote: > > On Fri, Feb 26, 2021 at 9:13 AM Borislav Petkov wrote: > > > > On Thu, Feb 25, 2021 at 01:58:48PM -0800, Nick Desaulniers wrote: > > > The config that reproduces it wasn't shared here; I wouldn't be > > > surprised if this was found via ran

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-26 Thread Arnd Bergmann
On Fri, Feb 26, 2021 at 9:13 AM Borislav Petkov wrote: > > On Thu, Feb 25, 2021 at 01:58:48PM -0800, Nick Desaulniers wrote: > > The config that reproduces it wasn't shared here; I wouldn't be > > surprised if this was found via randconfig that enabled some config > > that led to excessive code bl

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-26 Thread Borislav Petkov
On Thu, Feb 25, 2021 at 01:58:48PM -0800, Nick Desaulniers wrote: > The config that reproduces it wasn't shared here; I wouldn't be > surprised if this was found via randconfig that enabled some config > that led to excessive code bloat somewhere somehow. I'm sceptical it is the .config. As I said

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Peter Zijlstra
On Thu, Feb 25, 2021 at 12:31:33PM -0800, Nick Desaulniers wrote: > Q: But I put the `inline` keyword on the callee? > A: Probably deserves its own post, but the `inline` keyword doesn't > mean what any rational initial impression would suppose. Language in > the standard refers to "inline substit

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Arnd Bergmann
On Thu, Feb 25, 2021 at 10:59 PM 'Nick Desaulniers' via Clang Built Linux wrote: > On Thu, Feb 25, 2021 at 1:33 PM Borislav Petkov wrote: > > > > But apparently the cost model has decided that this is not inlineable. > > Maybe because that function ptr is assigned at boot time and that > > someho

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Nick Desaulniers
On Thu, Feb 25, 2021 at 1:33 PM Borislav Petkov wrote: > > On Thu, Feb 25, 2021 at 12:31:33PM -0800, Nick Desaulniers wrote: > > (full thread: > > https://lore.kernel.org/lkml/20210225112247.2240389-1-a...@kernel.org/) > > I suspect in this specific case, "Interprocedural Sparse Conditional > > C

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Borislav Petkov
Hi Nick, On Thu, Feb 25, 2021 at 12:31:33PM -0800, Nick Desaulniers wrote: > So LLVM is telling us bar() was inlined into foo(); (baz() can't be > because it wasn't defined in this TU). You can use this to "watch" > the compiler make decisions about inlining. thanks for taking the time to write

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Nick Desaulniers
On Thu, Feb 25, 2021 at 5:20 AM Arnd Bergmann wrote: > > On Thu, Feb 25, 2021 at 1:42 PM Borislav Petkov wrote: > > > > On Thu, Feb 25, 2021 at 01:18:21PM +0100, Arnd Bergmann wrote: > > > Either way works correctly, I don't care much, but picked the __init > > > annotation as it seemed more intu

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Arnd Bergmann
On Thu, Feb 25, 2021 at 1:42 PM Borislav Petkov wrote: > > On Thu, Feb 25, 2021 at 01:18:21PM +0100, Arnd Bergmann wrote: > > Either way works correctly, I don't care much, but picked the __init > > annotation as it seemed more intuitive. If the compiler decides to > > make it out-of-line for what

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Borislav Petkov
On Thu, Feb 25, 2021 at 01:18:21PM +0100, Arnd Bergmann wrote: > Either way works correctly, I don't care much, but picked the __init > annotation as it seemed more intuitive. If the compiler decides to > make it out-of-line for whatever reason, Well, frankly, I see no good reason for not inlining

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Arnd Bergmann
On Thu, Feb 25, 2021 at 12:45 PM Borislav Petkov wrote: > On Thu, Feb 25, 2021 at 12:22:41PM +0100, Arnd Bergmann wrote: > > -static inline void get_smp_config(void) > > +static inline __init void get_smp_config(void) > > __always_inline then I guess. > > Not inlining those is just silly. Either

Re: [PATCH] x86: mark some mpspec inline functions as __init

2021-02-25 Thread Borislav Petkov
On Thu, Feb 25, 2021 at 12:22:41PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > clang-13 sometimes decides to not inline early_get_smp_config(), > which leads to a link-time warning: > > WARNING: modpost: vmlinux.o(.text+0x838cc): Section mismatch in reference > from the function early