* [PATCH] KVM: SVM: Fix FPU leak and re-enable lazy FPU switching
@ 2007-11-19 15:57 Amit Shah
[not found] ` <11954878552130-git-send-email-amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Amit Shah @ 2007-11-19 15:57 UTC (permalink / raw)
To: avi-atKUWr5tajBWk0Htik3J/w
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Amit Shah
The clts code didn't use set_cr0 properly, so our lazy FPU
processing wasn't being done by the clts instruction at all.
This fixes all the FPU leaks, so re-enabling lazy FPU
optimization.
Signed-off-by: Amit Shah <amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
---
drivers/kvm/svm.c | 2 --
drivers/kvm/x86.c | 3 +--
2 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 1c3cc3e..928fb35 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1601,13 +1601,11 @@ static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root)
svm->vmcb->save.cr3 = root;
force_new_asid(vcpu);
-#if 0 /* lazy fpu is broken on AMD for now */
if (vcpu->fpu_active) {
svm->vmcb->control.intercept_exceptions |= (1 << NM_VECTOR);
svm->vmcb->save.cr0 |= X86_CR0_TS;
vcpu->fpu_active = 0;
}
-#endif
}
static void svm_inject_page_fault(struct kvm_vcpu *vcpu,
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index f832aa0..69b00da 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -1283,8 +1283,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
int emulate_clts(struct kvm_vcpu *vcpu)
{
- vcpu->cr0 &= ~X86_CR0_TS;
- kvm_x86_ops->set_cr0(vcpu, vcpu->cr0);
+ kvm_x86_ops->set_cr0(vcpu, vcpu->cr0 & ~X86_CR0_TS);
return X86EMUL_CONTINUE;
}
--
1.5.3
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-20 11:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-19 15:57 [PATCH] KVM: SVM: Fix FPU leak and re-enable lazy FPU switching Amit Shah
[not found] ` <11954878552130-git-send-email-amit.shah-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-20 11:31 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox