Re: [PATCH] kbuild: drop support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3

2022-07-10 Thread Masahiro Yamada
On Wed, Jun 29, 2022 at 6:06 AM Nick Desaulniers
 wrote:
>
> The difference in most compilers between `-O3` and `-O2` is mostly down
> to whether loops with statically determinable trip counts are fully
> unrolled vs unrolled to a multiple of SIMD width.
>
> This patch is effectively a revert of
> commit 15f5db60a137 ("kbuild,arc: add
> CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC") without re-adding
> ARCH_CFLAGS
>
> Ever since
> commit cfdbc2e16e65 ("ARC: Build system: Makefiles, Kconfig, Linker
> script")
> ARC has been built with -O3, though the reason for doing so was not
> specified in inline comments or the commit message. This commit does not
> re-add -O3 to arch/arc/Makefile.
>
> Folks looking to experiment with `-O3` (or any compiler flag for that
> matter) may pass them along to the command line invocation of make:
>
> $ make KCFLAGS=-O3
>
> Code that looks to re-add an explicit Kconfig option for `-O3` should
> provide:
> 1. A rigorous and reproducible performance profile of a reasonable
>userspace workload that demonstrates a hot loop in the kernel that
>would benefit from `-O3` over `-O2`.
> 2. Disassembly of said loop body before and after.
> 3. Provides stats on terms of increase in file size.
>
> Link: 
> https://lore.kernel.org/linux-kbuild/ca+55afz2snbbzyg-_i8_ldr2e8o9dfvdsfhhurzvtp2vmau...@mail.gmail.com/
> Signed-off-by: Nick Desaulniers 
> ---

Applied to linux-kbuild.
Thanks.


>  Makefile   | 2 --
>  arch/arc/configs/axs101_defconfig  | 1 -
>  arch/arc/configs/axs103_defconfig  | 1 -
>  arch/arc/configs/axs103_smp_defconfig  | 1 -
>  arch/arc/configs/haps_hs_defconfig | 1 -
>  arch/arc/configs/haps_hs_smp_defconfig | 1 -
>  arch/arc/configs/hsdk_defconfig| 1 -
>  arch/arc/configs/nsim_700_defconfig| 1 -
>  arch/arc/configs/nsimosci_defconfig| 1 -
>  arch/arc/configs/nsimosci_hs_defconfig | 1 -
>  arch/arc/configs/nsimosci_hs_smp_defconfig | 1 -
>  arch/arc/configs/tb10x_defconfig   | 1 -
>  arch/arc/configs/vdk_hs38_defconfig| 1 -
>  arch/arc/configs/vdk_hs38_smp_defconfig| 1 -
>  init/Kconfig   | 7 ---
>  15 files changed, 22 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 8973b285ce6c..b69f6cd7f2e2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -755,8 +755,6 @@ KBUILD_CFLAGS   += $(call cc-disable-warning, 
> address-of-packed-member)
>
>  ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
>  KBUILD_CFLAGS += -O2
> -else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
> -KBUILD_CFLAGS += -O3
>  else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>  KBUILD_CFLAGS += -Os
>  endif
> diff --git a/arch/arc/configs/axs101_defconfig 
> b/arch/arc/configs/axs101_defconfig
> index 0016149f9583..e31a8ebc3ecc 100644
> --- a/arch/arc/configs/axs101_defconfig
> +++ b/arch/arc/configs/axs101_defconfig
> @@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
>  # CONFIG_UTS_NS is not set
>  # CONFIG_PID_NS is not set
>  CONFIG_BLK_DEV_INITRD=y
> -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
>  CONFIG_EMBEDDED=y
>  CONFIG_PERF_EVENTS=y
>  # CONFIG_VM_EVENT_COUNTERS is not set
> diff --git a/arch/arc/configs/axs103_defconfig 
> b/arch/arc/configs/axs103_defconfig
> index 5b031582a1cf..e0e8567f0d75 100644
> --- a/arch/arc/configs/axs103_defconfig
> +++ b/arch/arc/configs/axs103_defconfig
> @@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
>  # CONFIG_UTS_NS is not set
>  # CONFIG_PID_NS is not set
>  CONFIG_BLK_DEV_INITRD=y
> -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
>  CONFIG_EMBEDDED=y
>  CONFIG_PERF_EVENTS=y
>  # CONFIG_VM_EVENT_COUNTERS is not set
> diff --git a/arch/arc/configs/axs103_smp_defconfig 
> b/arch/arc/configs/axs103_smp_defconfig
> index d4eec39e0112..fcbc952bc75b 100644
> --- a/arch/arc/configs/axs103_smp_defconfig
> +++ b/arch/arc/configs/axs103_smp_defconfig
> @@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
>  # CONFIG_UTS_NS is not set
>  # CONFIG_PID_NS is not set
>  CONFIG_BLK_DEV_INITRD=y
> -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
>  CONFIG_EMBEDDED=y
>  CONFIG_PERF_EVENTS=y
>  # CONFIG_VM_EVENT_COUNTERS is not set
> diff --git a/arch/arc/configs/haps_hs_defconfig 
> b/arch/arc/configs/haps_hs_defconfig
> index 7337cdf4ffdd..d87ad7e88d62 100644
> --- a/arch/arc/configs/haps_hs_defconfig
> +++ b/arch/arc/configs/haps_hs_defconfig
> @@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y
>  # CONFIG_UTS_NS is not set
>  # CONFIG_PID_NS is not set
>  CONFIG_BLK_DEV_INITRD=y
> -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
>  CONFIG_EXPERT=y
>  CONFIG_PERF_EVENTS=y
>  # CONFIG_COMPAT_BRK is not set
> diff --git a/arch/arc/configs/haps_hs_smp_defconfig 
> b/arch/arc/configs/haps_hs_smp_defconfig
> index bc927221afc0..8d82cdb7f86a 100644
> --- a/arch/arc/configs/haps_hs_smp_defconfig
> +++ b/arch/arc/configs/haps_hs_smp_defconfig
> @@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y
>  # CONFIG_UTS_NS is not set
>  # CONFIG_PID_NS is not set
>  CONFIG_BLK_DEV_INITRD=y
> -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
>  CONFIG_EMBEDDED

Re: [PATCH] kbuild: drop support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3

2022-07-10 Thread Masahiro Yamada
On Wed, Jun 29, 2022 at 7:48 PM Miko Larsson  wrote:
>
> On Tuesday, 28 June 2022 23:04:07 CEST Nick Desaulniers wrote:
> > The difference in most compilers between `-O3` and `-O2` is mostly down
> > to whether loops with statically determinable trip counts are fully
> > unrolled vs unrolled to a multiple of SIMD width.
> >
> > This patch is effectively a revert of
> > commit 15f5db60a137 ("kbuild,arc: add
> > CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC") without re-adding
> > ARCH_CFLAGS
> >
> > Ever since
> > commit cfdbc2e16e65 ("ARC: Build system: Makefiles, Kconfig, Linker
> > script")
> > ARC has been built with -O3, though the reason for doing so was not
> > specified in inline comments or the commit message. This commit does not
> > re-add -O3 to arch/arc/Makefile.
> >
> > Folks looking to experiment with `-O3` (or any compiler flag for that
> > matter) may pass them along to the command line invocation of make:
> >
> > $ make KCFLAGS=-O3
> >
> > Code that looks to re-add an explicit Kconfig option for `-O3` should
> > provide:
> > 1. A rigorous and reproducible performance profile of a reasonable
> >userspace workload that demonstrates a hot loop in the kernel that
> >would benefit from `-O3` over `-O2`.
> > 2. Disassembly of said loop body before and after.
> > 3. Provides stats on terms of increase in file size.
> >
>
> Might be worth cleaning up the rest of the kernel of instances of -O3,
> too. -O3 used to build lz4 and mips vdso, for instance. Might be a bit
> of a digression, though


This patch focuses on the removal of CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3,
so I think it is OK as-is.

The rest of cleanups, if needed,
should be submitted separately.




>
> --
> ~miko
>
>


-- 
Best Regards
Masahiro Yamada

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc