Re: [tip: x86/fpu] x86/fpu: Improve crypto performance by making kernel-mode FPU reliably usable in softirqs

From: Eric Biggers
Date: Thu Mar 06 2025 - 12:54:52 EST


On Thu, Mar 06, 2025 at 12:00:16PM -0000, tip-bot2 for Eric Biggers wrote:
> Performance results:
> ====================
>
> I did some benchmarks with AES-XTS encryption of 16-byte messages (which is
> unrealistically small, but this makes it easier to see the overhead of
> kernel-mode FPU...). The baseline was 384 MB/s. Removing the use of
> crypto/simd.c, which this work makes possible, increases it to 487 MB/s,
> a +27% improvement in throughput.
>
> CPU was AMD Ryzen 9 9950X (Zen 5). No debugging options were enabled.
>
> [ mingo: Prettified the changelog and added performance results. ]
>
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Andy Lutomirski <luto@xxxxxxxxxx>
> Cc: H. Peter Anvin <hpa@xxxxxxxxx>
> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
> Cc: Uros Bizjak <ubizjak@xxxxxxxxx>
> Link: https://lore.kernel.org/r/20250304204954.3901-1-ebiggers@xxxxxxxxxx

Thanks! To clarify, the removal of the use of crypto/simd.c from
arch/x86/crypto/, which is what gives the measured performance improvement,
happens in a separate patch
https://lore.kernel.org/r/20250220051325.340691-3-ebiggers@xxxxxxxxxx/ which
depends on this one. I'll try to get applied to the crypto tree in 6.16
(probably split into multiple patches).

As I've mentioned, there can also be a much larger performance improvement in
certain cases where the slow fallback path was being taken, or when users were
requesting a synchronous algorithm and therefore couldn't use the AES-NI code.

- Eric