[PATCH v2 00/20] arm64: Move kernel mode FPSIMD buffer to the stack

Eric Biggers ebiggers at kernel.org
Fri Oct 3 13:28:49 PDT 2025


On Wed, Oct 01, 2025 at 11:02:02PM +0200, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb at kernel.org>
> 
> Move the buffer for preserving/restoring the kernel mode FPSIMD state on a
> context switch out of struct thread_struct, and onto the stack, so that
> the memory cost is not imposed needlessly on all tasks in the system.
> 
> Changes since v1:
> - Add a patch reverting the arm64 support for the generic
>   kernel_fpu_begin()/end() API, which is problematic on arm64.
> 
> - Introduce a new 'ksimd' scoped guard that encapsulates the calls the
>   kernel_neon_begin() and kernel_neon_end() at a higher level of
>   abstraction. This makes it straight-forward to plumb in the stack
>   buffer without complicating the callers.
> 
> - Move all kernel mode NEON users on arm64 (and some on ARM) over to the
>   new API.
> 
> - Add Mark's ack to patches #6 - #8
> 
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Will Deacon <will at kernel.org>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: Kees Cook <keescook at chromium.org>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Mark Brown <broonie at kernel.org>
> Cc: Eric Biggers <ebiggers at kernel.org>
> 
> Ard Biesheuvel (20):
>   arm64: Revert support for generic kernel mode FPU
>   arm64/simd: Add scoped guard API for kernel mode SIMD
>   ARM/simd: Add scoped guard API for kernel mode SIMD
>   crypto: aegis128-neon - Move to more abstract 'ksimd' guard API
>   raid6: Move to more abstract 'ksimd' guard API
>   crypto/arm64: aes-ce-ccm - Avoid pointless yield of the NEON unit
>   crypto/arm64: sm4-ce-ccm - Avoid pointless yield of the NEON unit
>   crypto/arm64: sm4-ce-gcm - Avoid pointless yield of the NEON unit
>   lib/crc: Switch ARM and arm64 to 'ksimd' scoped guard API
>   lib/crypto: Switch ARM and arm64 to 'ksimd' scoped guard API
>   crypto/arm64: aes-ccm - Switch to 'ksimd' scoped guard API
>   crypto/arm64: aes-blk - Switch to 'ksimd' scoped guard API
>   crypto/arm64: aes-gcm - Switch to 'ksimd' scoped guard API
>   crypto/arm64: nhpoly1305 - Switch to 'ksimd' scoped guard API
>   crypto/arm64: polyval - Switch to 'ksimd' scoped guard API
>   crypto/arm64: sha3 - Switch to 'ksimd' scoped guard API
>   crypto/arm64: sm3 - Switch to 'ksimd' scoped guard API
>   crypto/arm64: sm4 - Switch to 'ksimd' scoped guard API
>   arm64/xorblocks:  Switch to 'ksimd' scoped guard API
>   arm64/fpsimd: Allocate kernel mode FP/SIMD buffers on the stack

Reviewed-by: Eric Biggers <ebiggers at kernel.org>

- Eric



More information about the linux-arm-kernel mailing list