summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/kvm_cache_regs.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-12-05 17:56:11 +0100
committerAvi Kivity <avi@redhat.com>2011-01-12 10:31:16 +0100
commitaff48baa34c033318ad322ecbf2e4bcd891b29ca (patch)
tree84955c55c812dd540cd0c54e5bdf6d3f5bfd08be /arch/x86/kvm/kvm_cache_regs.h
parentKVM: Replace reads of vcpu->arch.cr3 by an accessor (diff)
downloadlinux-aff48baa34c033318ad322ecbf2e4bcd891b29ca.tar.xz
linux-aff48baa34c033318ad322ecbf2e4bcd891b29ca.zip
KVM: Fetch guest cr3 from hardware on demand
Instead of syncing the guest cr3 every exit, which is expensince on vmx with ept enabled, sync it only on demand. [sheng: fix incorrect cr3 seen by Windows XP] Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/kvm_cache_regs.h')
-rw-r--r--arch/x86/kvm/kvm_cache_regs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h
index a6bf8db326f5..3377d53fcd36 100644
--- a/arch/x86/kvm/kvm_cache_regs.h
+++ b/arch/x86/kvm/kvm_cache_regs.h
@@ -75,6 +75,8 @@ static inline ulong kvm_read_cr4_bits(struct kvm_vcpu *vcpu, ulong mask)
static inline ulong kvm_read_cr3(struct kvm_vcpu *vcpu)
{
+ if (!test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail))
+ kvm_x86_ops->decache_cr3(vcpu);
return vcpu->arch.cr3;
}