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 <[EMAIL PROTECTED]>
---
 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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to