Skip to content

RFC crypto: ARM - run kernel mode NEON with softirqs disabled

Ard Biesheuvel linux-arm-kernel linux-crypto 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ARM: vfp: allow kernel mode NEON in softirq contextarch/arm/include/asm/simd.h arch/arm/vfp/vfpmodule.c+19 -40 replies
2/3crypto: arm/aes-ce - drop non-SIMD fallbacks and SIMD helperarch/arm/crypto/aes-ce-glue.c+3 -810 replies
3/3crypto: arm/aes-neonbs - drop non-SIMD fallbacks and SIMD helperarch/arm/crypto/aes-neonbs-glue.c+9 -1100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] crypto: ARM - run kernel mode NEON with softirqs disabled

This series is presented in response to the discussion [0] that has been going on on the linux-crypto list regarding the use of SIMD in synchronous skciphers and AEADs, which is problematic if such transforms may be used in softirq context while the SIMD unit is already being used by the kernel in process context as well.

This series proposes a way to work around this restriction. It is mainly intended to elicit discussion, so it is based on ARM not x86, which is probably more instructive, given that ARM does not permit SIMD use in softirq context at all (which is changed by patch #1), and also already carries some of these fallbacks that we should be able to remove if these changes work as intended (patches #2 and #3)

The primary assumption here is that use of skciphers and AEADs is currently only supported in process or softirq context. If this is true, we can avoid the need for dealing with nested use of the SIMD unit (when softirq uses the SIMD unit while it is already being used in process context), by disabling softirq processing entirely when the NEON unit is enabled for kernel mode use.

If this approach works and turns out to be suitable for x86 as well (which will require a separate discussion involving the x86 maintainers), we will probably need to reduce the scope of the kernel_fpu_begin/end blocks to ensure that softirq processing latency is not affected. Given that x86 has recently been updated to drastically reduce the overhead of preserving/ restoring the FPU state, this should not adversely affect performance.

[0] https://lore.kernel.org/linux-crypto/[email protected]/

Cc Eric Biggers <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Ben Greear <[email protected]>

Ard Biesheuvel (3):
ARM: vfp: allow kernel mode NEON in softirq context
crypto: arm/aes-ce - drop non-SIMD fallbacks and SIMD helper
crypto: arm/aes-neonbs - drop non-SIMD fallbacks and SIMD helper

 arch/arm/crypto/aes-ce-glue.c     |  84 +-------------
 arch/arm/crypto/aes-neonbs-glue.c | 119 ++------------------
 arch/arm/include/asm/simd.h       |  12 ++
 arch/arm/vfp/vfpmodule.c          |  11 +-
 4 files changed, 31 insertions(+), 195 deletions(-)
 create mode 100644 arch/arm/include/asm/simd.h
Signature · 1 line
2.17.1