Re: [PATCH v2 0/9] crypto: x86 - stop using the SIMD helper

Eric Biggers
2025-04-03T03:20:11Z

On Thu, Apr 03, 2025 at 10:56:35AM +0800, Herbert Xu wrote:
> On Thu, Apr 03, 2025 at 02:14:53AM +0000, Eric Biggers wrote:
> >
> > It's not the 90s anymore. Crypto is fast now, and used ubiquitously.
>
> I have to say that you've done a great job in improving crypto
> performance on x86 and I'm very pleased with being able to
> encrypt 256 bytes in just over 100 CPU cycles and doing a
> whole page takes less than 1000 cycles.
>
> But this is only possible with SIMD instructions which we do not
> support in hard IRQ context.
>

What? Take a look at siphash_1u32(), for example. That is crypto, and it is
fast. It doesn't use, or need to use, SIMD instructions.

Also, riscv has scalar AES instructions. (They aren't used by the kernel yet,
but they could be. The CRC code already uses scalar carryless multiplication.)

Obviously, it's also very common to really need the SIMD unit. That's the way
it is. But those are not all cases.

Also, as I said already, x86 does support SIMD instructions in hardirq context
in some cases. Whether anyone actually uses that, I don't know, but it is
explicitly supported. Check out irq_fpu_usable().

- Eric