[RFC PATCH 49/56] x86/fpu: Qualify warning in os_xsave

David Kaplan
2025-10-13T14:36:27Z

The warning about using FPU before alternatives are patched is only
relevant during boot. Ignore the warning unless the system is booting.
This suppresses the erroneous warning that can occur during alternative
re-patching at runtime.

Signed-off-by: David Kaplan <david.kaplan@amd.com>
---
arch/x86/kernel/fpu/xstate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h
index 52ce19289989..924552a20db1 100644
--- a/arch/x86/kernel/fpu/xstate.h
+++ b/arch/x86/kernel/fpu/xstate.h
@@ -220,7 +220,7 @@ static inline void os_xsave(struct fpstate *fpstate)
u32 hmask = mask >> 32;
int err;

- WARN_ON_FPU(!alternatives_patched);
+ WARN_ON_FPU(!alternatives_patched && system_state == SYSTEM_BOOTING);
xfd_validate_state(fpstate, mask, false);

XSTATE_XSAVE(&fpstate->regs.xsave, lmask, hmask, err);
--
2.34.1