diff options
author | Avi Kivity <avi@redhat.com> | 2010-12-05 19:56:11 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 12:31:16 +0300 |
commit | aff48baa34c033318ad322ecbf2e4bcd891b29ca (patch) | |
tree | 84955c55c812dd540cd0c54e5bdf6d3f5bfd08be /arch/x86/kvm/kvm_cache_regs.h | |
parent | 9f8fe5043fd26627c2fa2e9a41896885e675000b (diff) | |
download | linux-aff48baa34c033318ad322ecbf2e4bcd891b29ca.tar.xz |
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.h | 2 |
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; } |