Re: [PATCH v3 5/8] arm64/fpsimd: Drop special handling for EFI runtime services
From: Ard Biesheuvel <ardb@kernel.org>
Date: 2025-09-22 06:55:48
Also in:
linux-efi, lkml
On Thu, 18 Sept 2025 at 15:10, Mark Brown [off-list ref] wrote:
On Thu, Sep 18, 2025 at 12:30:16PM +0200, Ard Biesheuvel wrote:quoted
From: Ard Biesheuvel <ardb@kernel.org>quoted
Now that the use of kernel mode FP/SIMD is generally permitted when IRQs are disabled, the only purpose served by the EFI-specific fallback code in fpsimd.c is the case where an EFI call occurs from hardirq or NMI context. No such cases are known to occur in practice, and it is doubtful whether calling into the EFI firmware for any reason under such conditions would be a good idea to begin with. So disallow EFI runtime services in such cases. This means all the fallback code can be dropped.This is a really nice simplification, with the fixup rolled in: Reviewed-by: Mark Brown <broonie@kernel.org>
Sadly, this is not as simply as I had hoped. So even if we address the irqs_disabled() case, there are three remaining code paths where EFI pstore may end up calling the SetVariable() runtime service in hard IRQ or NMI context: panic(), oops_exit() and emergency_restart(). So disallowing this is problematic, as EFI pstore might be the only way to do a post mortem. As such an IRQ could potentially occur at a time when the FP/SIMD unit is being used both in task and in softirq context, there still needs to be some special handling, even though a) this condition is vanishingly rare, and so having elaborate logic like we do today that is never exercised is not great b) much of the logic deals with SVE which is user space only, and we can just disregard that under the conditions where we may enter in IRQ context.