summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorJunaid Shahid2018-06-27 23:59:18 +0200
committerPaolo Bonzini2018-08-06 17:59:00 +0200
commit956bf3531fba53c0501eda4fbc67950b0f7b913f (patch)
tree37e602fdc99567f8e5a702dfdbca00d415327099 /arch/x86/kvm/x86.c
parentkvm: x86: Support selectively freeing either current or previous MMU root (diff)
downloadkernel-qcow2-linux-956bf3531fba53c0501eda4fbc67950b0f7b913f.tar.gz
kernel-qcow2-linux-956bf3531fba53c0501eda4fbc67950b0f7b913f.tar.xz
kernel-qcow2-linux-956bf3531fba53c0501eda4fbc67950b0f7b913f.zip
kvm: x86: Skip shadow page resync on CR3 switch when indicated by guest
When the guest indicates that the TLB doesn't need to be flushed in a CR3 switch, we can also skip resyncing the shadow page tables since an out-of-sync shadow page table is equivalent to an out-of-sync TLB. Signed-off-by: Junaid Shahid <junaids@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 493afbf12e78..aa5d96b4b386 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -858,10 +858,10 @@ int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
#endif
if (cr3 == kvm_read_cr3(vcpu) && !pdptrs_changed(vcpu)) {
- kvm_mmu_sync_roots(vcpu);
-
- if (!skip_tlb_flush)
+ if (!skip_tlb_flush) {
+ kvm_mmu_sync_roots(vcpu);
kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
+ }
return 0;
}