[PATCH] perf/arm-cmn: reduce stack usage in arm_cmn_probe()
Arnd Bergmann
arnd at arndb.de
Fri Jun 27 11:37:53 PDT 2025
On Fri, Jun 27, 2025, at 19:57, Robin Murphy wrote:
> On 20/06/2025 12:51 pm, Arnd Bergmann wrote:
>
> At that point, though, it seems like we may as well just disable the
> warning :/
I had a couple of cases like this, where the same large stack
happens on both gcc and clang, and adding noinline makes clang
behave the same way as gcc, so neither of them warns. Leaving
the warning enabled at this point at least ensures that we catch
it if it ever increases further.
There is a different type of problem (mostly on powerpc and mips,
but sometimes on arm64) where the 'noinline' helps clang to not
produce some really bad object code with unnecessary temporaries
on the stack.
> Fortunately it's not actually that hard to improve matters here, so I've
> just sent that patch:
>
> https://lore.kernel.org/r/e7dd41bf0f1b098e2e4b01ef91318a4b272abff8.1751046159.git.robin.murphy@arm.com/T/#u
Nice, your version reduces the stack size from 1360 to 784 bytes
for my test randconfig, so that's clearly better than my version.
While attempting to reproduce this now, I also found that another
patch I had avoided the warning: I added -finline-max-stacksize=128
to the KASAN cflags, to work around some overeager inlining on
powerpc, and this had the same effect as my patch, but without
actually having to modify the sources.
Arnd
More information about the linux-arm-kernel
mailing list