llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] powerpc/lib/xor_vmx: Relax frame size for clang
       [not found]   ` <87v8pyemmw.fsf@mpe.ellerman.id.au>
@ 2022-09-08 15:07     ` Arnd Bergmann
  2022-09-08 22:40       ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2022-09-08 15:07 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Mathieu Malaterre, Nick Desaulniers
  Cc: linuxppc-dev, Paul Mackerras, linux-kernel, Joel Stanley, llvm

On Thu, Sep 8, 2022, at 2:27 AM, Michael Ellerman wrote:
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>
> Yeah that would make some sense.
>
> On 64-bit the largest frame in that file is 1424, which is below the
> default 2048 byte limit.
>
> So maybe just increase it for 32-bit && KASAN.
>
> What would be nice is if the FRAME_WARN value could be calculated as a
> percentage of the THREAD_SHIFT, but that's not easily doable with the
> way things are structured in Kconfig.
>

Increasing the warning limit slightly for 32-bit with
CONFIG_KASAN_STACK makes sense, but there are a lot of
related concerns:

- I was hoping to still stay under 1280 bytes for the warning
  limit, so that even with KASAN_STACK enabled, we are able to
  catch warnings in functions that use a stupid amount of
  local variables, without getting too many false positives.

- if the XOR code has its frame size explode like this, it's
  probably an indication of the compiler doing something wrong,
  not the kernel code. The result is likely that the "optimized"
  XOR implementation is slower than the default version as a
  result, and the kernel will pick the other one at boot time.
  This needs to be confirmed of course, but an easier workaround
  for this instance might be to just disable the xor_vmx module
  when KASAN_STACK is set.

- The warning limit on 32-bit is actually 2028 bytes when
  GCC_PLUGIN_LATENT_ENTROPY is set. I think this is a mistake
  and we should lower /that/ limit instead, but a side-effect
  here is that an allmodconfig kernel build with gcc will fail
  to warn about bugs that exist both with gcc and clang, while
  clang complains about it.

      Arnd

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/lib/xor_vmx: Relax frame size for clang
  2022-09-08 15:07     ` [PATCH] powerpc/lib/xor_vmx: Relax frame size for clang Arnd Bergmann
@ 2022-09-08 22:40       ` Segher Boessenkool
  0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2022-09-08 22:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Michael Ellerman, Christophe Leroy, Mathieu Malaterre,
	Nick Desaulniers, Paul Mackerras, llvm, linuxppc-dev,
	linux-kernel, Joel Stanley

Hi!

On Thu, Sep 08, 2022 at 05:07:24PM +0200, Arnd Bergmann wrote:
> - if the XOR code has its frame size explode like this, it's
>   probably an indication of the compiler doing something wrong,
>   not the kernel code.

On the contrary, it is most likely an indication that the kernel code
wants something unreasonable.  Like, having 20 variables live at the
same time, but still wanting nicely scheduled machine code generated.

But I suspect GCC unrolled the loops here, even?  Best way to prevent
that here is to put an option in the Makefile, for these files.  We
don't want any of this unrolled after all?  Or, alternatively, remove
all the manual unrolling from this code, let GCC do its thing, without
painting it in a corner.

>   The result is likely that the "optimized"
>   XOR implementation is slower than the default version as a
>   result, and the kernel will pick the other one at boot time.

Yes.  So it's self-healing even, of a sort :-)


Segher

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-08 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190621085822.1527-1-malat@debian.org>
     [not found] ` <7cb1285a-42e6-2b67-664f-7d206bc9fd80@csgroup.eu>
     [not found]   ` <87v8pyemmw.fsf@mpe.ellerman.id.au>
2022-09-08 15:07     ` [PATCH] powerpc/lib/xor_vmx: Relax frame size for clang Arnd Bergmann
2022-09-08 22:40       ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).