Re: [PATCH] compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING

From: Masahiro Yamada
Date: Mon Mar 25 2019 - 03:55:53 EST


On Mon, Mar 25, 2019 at 4:33 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Mon, Mar 25, 2019 at 7:11 AM Masahiro Yamada
> <yamada.masahiro@xxxxxxxxxxxxx> wrote:
> > On Wed, Mar 20, 2019 at 10:34 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > >
> > > On Wed, Mar 20, 2019 at 10:41 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > > >
> > > > I've added your patch to my randconfig test setup and will let you
> > > > know if I see anything noticeable. I'm currently testing clang-arm32,
> > > > clang-arm64 and gcc-x86.
> > >
> > > This is the only additional bug that has come up so far:
> > >
> > > `.exit.text' referenced in section `.alt.smp.init' of
> > > drivers/char/ipmi/ipmi_msghandler.o: defined in discarded section
> > > `exit.text' of drivers/char/ipmi/ipmi_msghandler.o
> > >
> > > diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
> > > index 201100226301..84b12e33104d 100644
> > > --- a/arch/arm/kernel/atags.h
> > > +++ b/arch/arm/kernel/atags.h
> > > @@ -5,7 +5,7 @@ void convert_to_tag_list(struct tag *tags);
> > > const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
> > > unsigned int machine_nr);
> > > #else
> > > -static inline const struct machine_desc *
> > > +static __always_inline const struct machine_desc *
> > > setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
> > > {
> > > early_print("no ATAGS support: can't continue\n");
> > >
> >
> >
> > I do not know why to reproduce it,
> > but is "__init __noreturn" more sensible than
> > "__always_inline" here?
>
> It's in a header file, so it has to be 'inline'. We could make it
> static inline __init __noreturn,

Yes, I like 'static inline __init __noreturn'

> but I don't see an advantage over
> __always_inline there.

__always_inline takes away the compiler's freedom.

I'd like to leave it up to the compiler where possible.

The inlining decision may change
depending on -O2, -Os, -Og(which was rejected)
or whatever optimization strategy.


>
> Arnd
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



--
Best Regards
Masahiro Yamada