Message ID | 20190419094754.24667-1-yamada.masahiro@socionext.com |
---|---|
Headers | show |
Series | compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING | expand |
Hi, On Fri, Apr 19, 2019 at 12:06 PM Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > This prepares to move CONFIG_OPTIMIZE_INLINING from x86 to a common > place. We need to eliminate potential issues beforehand. > > If it is enabled for mips, the following errors are reported: > > arch/mips/mm/sc-mips.o: In function `mips_sc_prefetch_enable.part.2': > sc-mips.c:(.text+0x98): undefined reference to `mips_gcr_base' > sc-mips.c:(.text+0x9c): undefined reference to `mips_gcr_base' > sc-mips.c:(.text+0xbc): undefined reference to `mips_gcr_base' > sc-mips.c:(.text+0xc8): undefined reference to `mips_gcr_base' > sc-mips.c:(.text+0xdc): undefined reference to `mips_gcr_base' > arch/mips/mm/sc-mips.o:sc-mips.c:(.text.unlikely+0x44): more undefined references to `mips_gcr_base' Tested with success on ppc32/G4. But on CI20 (ci20_defconfig from master), I get: MODPOST vmlinux.o mipsel-linux-gnu-ld: arch/mips/kernel/traps.o: in function `addr_gcr_err_control': /home/mathieu/tmp/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:169: undefined reference to `mips_gcr_base' mipsel-linux-gnu-ld: /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:169: undefined reference to `mips_gcr_base' mipsel-linux-gnu-ld: arch/mips/mm/sc-mips.o: in function `addr_gcr_l2_pft_control': /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: undefined reference to `mips_gcr_base' mipsel-linux-gnu-ld: /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: undefined reference to `mips_gcr_base' mipsel-linux-gnu-ld: /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: undefined reference to `mips_gcr_base' mipsel-linux-gnu-ld: arch/mips/mm/sc-mips.o:/home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: more undefined references to `mips_gcr_base' follow > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> > --- > > Changes in v2: > - new patch > > arch/mips/include/asm/bitops.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h > index 830c93a010c3..6a26ead1c2b6 100644 > --- a/arch/mips/include/asm/bitops.h > +++ b/arch/mips/include/asm/bitops.h > @@ -482,7 +482,7 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long * > * Return the bit position (0..63) of the most significant 1 bit in a word > * Returns -1 if no 1 bit exists > */ > -static inline unsigned long __fls(unsigned long word) > +static __always_inline unsigned long __fls(unsigned long word) > { > int num; > > -- > 2.17.1 >
On Fri, Apr 19, 2019 at 06:47:54PM +0900, Masahiro Yamada wrote: > Commit 60a3cdd06394 ("x86: add optimized inlining") introduced > CONFIG_OPTIMIZE_INLINING, but it has been available only for x86. > > The idea is obviously arch-agnostic. This commit moves the config > entry from arch/x86/Kconfig.debug to lib/Kconfig.debug so that all > architectures can benefit from it. > > This can make a huge difference in kernel image size especially when > CONFIG_OPTIMIZE_FOR_SIZE is enabled. > > For example, I got 3.5% smaller arm64 kernel for v5.1-rc1. > > dec file > 18983424 arch/arm64/boot/Image.before > 18321920 arch/arm64/boot/Image.after > > This also slightly improves the "Kernel hacking" Kconfig menu as > e61aca5158a8 ("Merge branch 'kconfig-diet' from Dave Hansen') suggested; > this config option would be a good fit in the "compiler option" menu. > > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> > --- > > Changes in v2: > - split into a separate patch > > arch/x86/Kconfig | 3 --- > arch/x86/Kconfig.debug | 14 -------------- > include/linux/compiler_types.h | 3 +-- > lib/Kconfig.debug | 14 ++++++++++++++ > 4 files changed, 15 insertions(+), 19 deletions(-) Acked-by: Borislav Petkov <bp@suse.de>
On Sat, Apr 20, 2019 at 12:45 AM Mathieu Malaterre <malat@debian.org> wrote: > > Hi, > > On Fri, Apr 19, 2019 at 12:06 PM Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: > > > > This prepares to move CONFIG_OPTIMIZE_INLINING from x86 to a common > > place. We need to eliminate potential issues beforehand. > > > > If it is enabled for mips, the following errors are reported: > > > > arch/mips/mm/sc-mips.o: In function `mips_sc_prefetch_enable.part.2': > > sc-mips.c:(.text+0x98): undefined reference to `mips_gcr_base' > > sc-mips.c:(.text+0x9c): undefined reference to `mips_gcr_base' > > sc-mips.c:(.text+0xbc): undefined reference to `mips_gcr_base' > > sc-mips.c:(.text+0xc8): undefined reference to `mips_gcr_base' > > sc-mips.c:(.text+0xdc): undefined reference to `mips_gcr_base' > > arch/mips/mm/sc-mips.o:sc-mips.c:(.text.unlikely+0x44): more undefined references to `mips_gcr_base' > > Tested with success on ppc32/G4. But on CI20 (ci20_defconfig from > master), I get: Thanks for the test! OK, I saw this error for ci20_defconfig. I inline'd __ffs() to fix it and sumitted v3. Thank you. > MODPOST vmlinux.o > mipsel-linux-gnu-ld: arch/mips/kernel/traps.o: in function > `addr_gcr_err_control': > /home/mathieu/tmp/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:169: > undefined reference to `mips_gcr_base' > mipsel-linux-gnu-ld: > /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:169: > undefined reference to `mips_gcr_base' > mipsel-linux-gnu-ld: arch/mips/mm/sc-mips.o: in function > `addr_gcr_l2_pft_control': > /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: > undefined reference to `mips_gcr_base' > mipsel-linux-gnu-ld: > /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: > undefined reference to `mips_gcr_base' > mipsel-linux-gnu-ld: > /home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: > undefined reference to `mips_gcr_base' > mipsel-linux-gnu-ld: > arch/mips/mm/sc-mips.o:/home/mathieu/linux/linux/ci20/../arch/mips/include/asm/mips-cm.h:246: > more undefined references to `mips_gcr_base' follow