Skip to content

ARM: allow kernel mode NEON in softirq context

Ard Biesheuvel linux-arm-kernel linux-crypto 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 7 repliesIn review
  2. v11 patch 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ARM: vfp: Manipulate VFP state with softirqs disabledarch/arm/include/asm/assembler.h arch/arm/kernel/asm-offsets.c arch/arm/vfp/entry.S +2 more+24 -121 reply
2/2ARM: permit non-nested kernel mode NEON in softirq contextarch/arm/include/asm/simd.h arch/arm/vfp/vfpmodule.c+14 -74 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchMartin WilliLinus Walleij
SeriesT-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] ARM: allow kernel mode NEON in softirq context

Currently on ARM, we only permit kernel mode NEON in task context, and NEON based processing triggered from softirq context is queued for asynchronous completion via the crypto API's cryptd layer.

For IPsec packet encryption involving highly performant crypto implementations, this results in a substantial performance hit, and so it would be desirable to permit those crypto operations to complete synchronously even when invoked from softirq context.

For example, on a 1 GHz Cortex-A53 machine (SynQuacer), AES-256-GCM executes in 7.2 cycles per byte, putting an upper bound of ~140 MB/s on the achievable throughput of a single CPU.

Without these changes, an IPsec tunnel from a 32-bit VM to the 64-bit host can achieve a throughput of 9.5 MB/s TX and 11.9 MB/s RX.

When the crypto algorithm is permitted to execute in softirq context, the throughput increases to 16.5 MB/s TX and 41 MB/s RX.

(This is measured using debian's iperf3 3.11 with the default options)

So let's reorganize the VFP state handling so that it its critical handling of the FPU registers runs with softirqs disabled. Then, update the kernel_neon_begin()/end() logic to keep softirq processing disabled as long as the NEON is being used in kernel mode.

Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Russell King <[email protected]>

Ard Biesheuvel (2):
ARM: vfp: Manipulate VFP state with softirqs disabled
ARM: permit non-nested kernel mode NEON in softirq context

 arch/arm/include/asm/assembler.h | 19 ++++++++++++-------
 arch/arm/include/asm/simd.h      |  8 ++++++++
 arch/arm/kernel/asm-offsets.c    |  1 +
 arch/arm/vfp/entry.S             |  4 ++--
 arch/arm/vfp/vfphw.S             |  4 ++--
 arch/arm/vfp/vfpmodule.c         | 19 ++++++++++++-------
 6 files changed, 37 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/include/asm/simd.h
Signature · 1 line
2.35.1