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

From: Arnd Bergmann
Date: Thu Feb 25 2021 - 17:22:40 EST


On Thu, Feb 25, 2021 at 10:59 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
> On Thu, Feb 25, 2021 at 1:33 PM Borislav Petkov <bp@xxxxxxxxx> 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
> > somehow gets the cost model to give it a very high (or low) value. Or
> > maybe because the wrappers are calling through a variable - the x86_init
> > thing - which is in a different section and that confuses the inliner.
> > Or whatever - totally speculating here.
>
> 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.

It was the case in some similar bugfixes I sent, but in this one, the
out-of-line function was fairly trivial -- there is one call to a sanitizer
but that's it:

.section .init.text,"ax",@progbits
.type early_get_smp_config,@function # -- Begin function
early_get_smp_config
early_get_smp_config: # @early_get_smp_config
# %bb.0:
callq __sanitizer_cov_trace_pc@PLT
movl $1, %edi
jmpq *x86_init+40(%rip) # TAILCALL
.Lfunc_end4:
.size early_get_smp_config, .Lfunc_end4-early_get_smp_config

I've uploaded the .config to https://pastebin.com/CvvEScnQ

This is with today's linux-next-20210225 plus a number of patches
to address other build failures.

Arnd