KVM: VMX: do not overwrite uptodate vcpu->arch.cr3 on KVM_SET_SREGS
authorMarcelo Tosatti <mtosatti@redhat.com>
Mon, 6 Jun 2011 17:27:47 +0000 (14:27 -0300)
committerAvi Kivity <avi@redhat.com>
Sun, 19 Jun 2011 16:23:13 +0000 (19:23 +0300)
Only decache guest CR3 value if vcpu->arch.cr3 is stale.
Fixes loadvm with live guest.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Tested-by: Markus Schade <markus.schade@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c

index 4c3fa0f..d48ec60 100644 (file)
@@ -2047,7 +2047,8 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0,
                                        unsigned long cr0,
                                        struct kvm_vcpu *vcpu)
 {
-       vmx_decache_cr3(vcpu);
+       if (!test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail))
+               vmx_decache_cr3(vcpu);
        if (!(cr0 & X86_CR0_PG)) {
                /* From paging/starting to nonpaging */
                vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,