|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/traps: Remove lazy FPU support
commit 47d75569250340874e432cfc1706fbd148cecc9d
Author: Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Tue Mar 24 18:19:33 2026 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Mar 30 15:48:13 2026 +0100
x86/traps: Remove lazy FPU support
Remove lazy FPU support from the #NM exception handler used by PV
guests since fully_eager_fpu is now always true.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
xen/arch/x86/i387.c | 24 ------------------------
xen/arch/x86/include/asm/i387.h | 1 -
xen/arch/x86/pv/misc-hypercalls.c | 3 +--
xen/arch/x86/traps.c | 20 +++++++++++++-------
4 files changed, 14 insertions(+), 34 deletions(-)
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 954ba3b179..7da731865f 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -234,30 +234,6 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool
need_stts)
stts();
}
-/*
- * Restore FPU state when #NM is triggered.
- */
-void vcpu_restore_fpu_lazy(struct vcpu *v)
-{
- ASSERT(!is_idle_vcpu(v));
-
- /* Avoid recursion. */
- clts();
-
- if ( v->fpu_dirtied )
- return;
-
- ASSERT(!v->arch.fully_eager_fpu);
-
- if ( cpu_has_xsave )
- fpu_xrstor(v, XSTATE_LAZY);
- else
- fpu_fxrstor(v);
-
- v->fpu_initialised = 1;
- v->fpu_dirtied = 1;
-}
-
/*
* On each context switch, save the necessary FPU info of VCPU being switch
* out. It dispatches saving operation based on CPU's capability.
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index 652d7ad2de..da0c7e945f 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -28,7 +28,6 @@ struct ix87_env {
};
void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
-void vcpu_restore_fpu_lazy(struct vcpu *v);
void vcpu_save_fpu(struct vcpu *v);
void save_fpu_enable(void);
int vcpu_init_fpu(struct vcpu *v);
diff --git a/xen/arch/x86/pv/misc-hypercalls.c
b/xen/arch/x86/pv/misc-hypercalls.c
index 7e915d86b7..34a0717540 100644
--- a/xen/arch/x86/pv/misc-hypercalls.c
+++ b/xen/arch/x86/pv/misc-hypercalls.c
@@ -42,8 +42,7 @@ long do_fpu_taskswitch(int set)
else
{
v->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
- if ( v->fpu_dirtied )
- clts();
+ clts();
}
return 0;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b6b1197697..8aa1e4181b 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2045,15 +2045,21 @@ void asmlinkage do_device_not_available(struct
cpu_user_regs *regs)
}
#ifdef CONFIG_PV
- vcpu_restore_fpu_lazy(curr);
-
- if ( curr->arch.pv.ctrlreg[0] & X86_CR0_TS )
+ if ( !(curr->arch.pv.ctrlreg[0] & X86_CR0_TS) )
{
- pv_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
- curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
+ ASSERT_UNREACHABLE();
+ domain_crash(curr->domain, "#NM but vCR0.TS clear\n");
+ return;
}
- else
- TRACE_TIME(TRC_PV_MATH_STATE_RESTORE);
+
+ /*
+ * For better or worse, Xen's ABI with PV guests always clears TS on an #NM
+ * exception. Classic-xen Linux depends on this.
+ */
+ clts();
+ curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
+
+ pv_inject_hw_exception(X86_EXC_NM, X86_EVENT_NO_EC);
#else
ASSERT_UNREACHABLE();
#endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |