public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Compiler Attributes, s390: Provide and use __uninitialized macro
@ 2024-02-05 15:48 Heiko Carstens
  2024-02-05 15:48 ` [PATCH 1/2] Compiler Attributes: Add " Heiko Carstens
  2024-02-05 15:48 ` [PATCH 2/2] s390/fpu: make use of " Heiko Carstens
  0 siblings, 2 replies; 9+ messages in thread
From: Heiko Carstens @ 2024-02-05 15:48 UTC (permalink / raw)
  To: Kees Cook, Nathan Chancellor, Nick Desaulniers
  Cc: linux-kernel, linux-s390, Vasily Gorbik, Alexander Gordeev

With INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO enabled the kernel will
be compiled with -ftrivial-auto-var-init=<...> which causes initialization
of stack variables at function entry time.

In order to avoid the performance impact that comes with this users can use
the "uninitialized" attribute to prevent such initialization.

In particular code sections in s390 specific kernel code which use floating
point or vector registers all come with a 520 byte stack variable to save
already in use registers, if required.

If the above named config options are enabled this stack variable will
always be initialized on function entry in addition to saving register
contents, which contradicts the intend (performance improvement) of such
code sections.

Therefore provide a generic __uninitialized macro and an s390 specific
DECLARE_KERNEL_FPU_ONSTACK() macro which provides a kernel fpu variable
with an __uninitialized attribute, and convert all existing code to use
this.

If people are ok which this approach, I'd like to carry this via the s390
tree to avoid potential merge conflicts, since there is a larger fpu code
rework pending

Thanks,
Heiko

Heiko Carstens (2):
  Compiler Attributes: Add __uninitialized macro
  s390/fpu: make use of __uninitialized macro

 arch/s390/crypto/chacha-glue.c      |  2 +-
 arch/s390/crypto/crc32-vx.c         |  2 +-
 arch/s390/include/asm/fpu/types.h   |  3 +++
 arch/s390/kernel/sysinfo.c          |  2 +-
 include/linux/compiler_attributes.h | 12 ++++++++++++
 lib/raid6/s390vx.uc                 |  4 ++--
 6 files changed, 20 insertions(+), 5 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2024-02-06  1:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-05 15:48 [PATCH 0/2] Compiler Attributes, s390: Provide and use __uninitialized macro Heiko Carstens
2024-02-05 15:48 ` [PATCH 1/2] Compiler Attributes: Add " Heiko Carstens
2024-02-05 16:21   ` Kees Cook
2024-02-06  1:28   ` Nathan Chancellor
2024-02-05 15:48 ` [PATCH 2/2] s390/fpu: make use of " Heiko Carstens
2024-02-05 16:26   ` Kees Cook
2024-02-05 16:35     ` Heiko Carstens
2024-02-05 17:00       ` Kees Cook
2024-02-06  1:31   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox