diff options
author | Junaid Shahid <junaids@google.com> | 2018-06-27 14:59:18 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-08-06 17:59:00 +0200 |
commit | 956bf3531fba53c0501eda4fbc67950b0f7b913f (patch) | |
tree | 37e602fdc99567f8e5a702dfdbca00d415327099 /arch/x86/kvm/x86.c | |
parent | 08fb59d8a47d5e1f9de08659603a47f117fe60d5 (diff) | |
download | linux-956bf3531fba53c0501eda4fbc67950b0f7b913f.tar.bz2 |
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.c | 6 |
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; } |