Re: [PATCH] crypto: lib/sha256 - Disable SIMD
From: Thomas Gleixner
Date: Fri May 16 2025 - 16:34:45 EST
On Fri, May 16 2025 at 12:06, Eric Biggers wrote:
> What would you say about going back to my earlier plan to make irq_fpu_usable()
> return false when irqs_disabled(), like what arm64 does? (As I had in
> https://lore.kernel.org/lkml/20250220051325.340691-2-ebiggers@xxxxxxxxxx/).
> + return !this_cpu_read(in_kernel_fpu) &&
> + !in_hardirq() && !irqs_disabled() && !in_nmi();
The !in_hardirq() is redundant because hard interrupt context runs with
interrupts disabled.
> I think that would handle all these cases, as well as others. We'd need to fix
> __save_processor_state() to save the FPU state directly without pretending that
> it's using kernel-mode FPU, but I don't know of any issues besides
> that.
Looks about right.
> Then we could also delete the irqs_disabled() checks that I added to
> kernel_fpu_begin() and kernel_fpu_end().
Yes. That conditional locking is horrible.
Thanks,
tglx