linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] x86: Don't support kernel-mode FPU with hardirqs disabled
@ 2025-05-16 23:18 Eric Biggers
  2025-05-16 23:18 ` [PATCH 1/3] x86/fpu: Add fpu_save_state() for __save_processor_state() Eric Biggers
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Eric Biggers @ 2025-05-16 23:18 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, linux-crypto, linux-pm, Borislav Petkov,
	Thomas Gleixner, Ayush Jain, Herbert Xu, Ard Biesheuvel

This series returns to my earlier suggestion to make x86 not support
kernel-mode FPU when hardirqs are disabled, aligning it with arm64
(https://lore.kernel.org/r/20250220051325.340691-2-ebiggers@kernel.org).
To make this possible despite the use of the kernel-mode FPU functions
by __save_processor_state() (which I mentioned at
https://lore.kernel.org/r/20250228035924.GC5588@sol.localdomain), I've
changed __save_processor_state() to use a new function instead of
(mis)using the kernel-mode FPU functions.

This slightly reduces the overhead of kernel-mode FPU (since the result
is fewer checks), and it fixes the issue reported at
https://lore.kernel.org/r/20250516112217.GBaCcf6Yoc6LkIIryP@fat_crate.local/
where irq_fpu_usable() incorrectly returned false during CPU
initialization, causing a crash in the SHA-256 library code.

Eric Biggers (3):
  x86/fpu: Add fpu_save_state() for __save_processor_state()
  x86/pm: Use fpu_save_state() in __save_processor_state()
  x86/fpu: Don't support kernel-mode FPU when irqs_disabled()

 arch/x86/include/asm/fpu/api.h |  1 +
 arch/x86/kernel/fpu/core.c     | 92 ++++++++++++++++++++--------------
 arch/x86/power/cpu.c           | 18 +++----
 3 files changed, 62 insertions(+), 49 deletions(-)


base-commit: 8566fc3b96539e3235909d6bdda198e1282beaed
-- 
2.49.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-05-20  7:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-16 23:18 [PATCH 0/3] x86: Don't support kernel-mode FPU with hardirqs disabled Eric Biggers
2025-05-16 23:18 ` [PATCH 1/3] x86/fpu: Add fpu_save_state() for __save_processor_state() Eric Biggers
2025-05-16 23:18 ` [PATCH 2/3] x86/pm: Use fpu_save_state() in __save_processor_state() Eric Biggers
2025-05-16 23:18 ` [PATCH 3/3] x86/fpu: Don't support kernel-mode FPU when irqs_disabled() Eric Biggers
2025-05-17  7:09   ` Ingo Molnar
2025-05-17 18:39     ` Eric Biggers
2025-05-18  6:34       ` Ingo Molnar
2025-05-18 13:18         ` Ard Biesheuvel
2025-05-18 20:01           ` Eric Biggers
2025-05-19  8:05             ` Ingo Molnar
2025-05-19  9:49               ` Ard Biesheuvel
2025-05-19 12:57                 ` Ingo Molnar
2025-05-19 13:50                   ` Ard Biesheuvel
2025-05-20  7:42                     ` Ingo Molnar
2025-05-17  1:30 ` [PATCH 0/3] x86: Don't support kernel-mode FPU with hardirqs disabled Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).