Re: [PATCH] Revert "Revert "powerpc/xmon: Relax frame size for clang""

From: Nathan Chancellor
Date: Mon Aug 28 2023 - 13:47:40 EST


On Mon, Aug 28, 2023 at 10:35:26AM -0700, ndesaulniers@xxxxxxxxxx wrote:
> This reverts commit 7f3c5d099b6f8452dc4dcfe4179ea48e6a13d0eb.
>
> Turns out that this is reproducible still under specific compiler
> versions (mea culpa: I did not test every supported version of clang),
> and even a few randconfigs bots found.
>
> We'll have to revisit this again in the future, for now back this out.
>
> Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/252#issuecomment-1690371256
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/llvm/202308260344.Vc4Giuk7-lkp@xxxxxxxxx/
> Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

I know this is just a straight reapplication of the original workaround
but could we use ccflags here instead of KBUILD_CFLAGS (with it placed
after the NO_MIMINAL_TOC assignment)?

# clang stores addresses on the stack causing the frame size to blow
# out. See https://github.com/ClangBuiltLinux/linux/issues/252
ccflags-$(CONFIG_CC_IS_CLANG) += -Wframe-larger-than=4096

The addition to KBUILD_CFLAGS makes me think this flags will get applied
to the rest of the kernel but I have not actually verified.

Regardless:

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

Side note, seems like b4 is still doing the thing with "From:".

> ---
> arch/powerpc/xmon/Makefile | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
> index 7705aa74a24d..d334de392e6c 100644
> --- a/arch/powerpc/xmon/Makefile
> +++ b/arch/powerpc/xmon/Makefile
> @@ -10,6 +10,12 @@ KCSAN_SANITIZE := n
> # Disable ftrace for the entire directory
> ccflags-remove-$(CONFIG_FUNCTION_TRACER) += $(CC_FLAGS_FTRACE)
>
> +ifdef CONFIG_CC_IS_CLANG
> +# clang stores addresses on the stack causing the frame size to blow
> +# out. See https://github.com/ClangBuiltLinux/linux/issues/252
> +KBUILD_CFLAGS += -Wframe-larger-than=4096
> +endif
> +
> ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
>
> obj-y += xmon.o nonstdio.o spr_access.o xmon_bpts.o
>
> ---
> base-commit: 2ee82481c392eec06a7ef28df61b7f0d8e45be2e
> change-id: 20230828-ppc_rerevert-647427f04ce1
>
> Best regards,
> --
> Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
>