]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
KVM: nVMX: Don't flush TLB on nested VMX transition
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 20 Mar 2020 21:28:30 +0000 (14:28 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 21 Apr 2020 13:12:58 +0000 (09:12 -0400)
Unconditionally skip the TLB flush triggered when reusing a root for a
nested transition as nested_vmx_transition_tlb_flush() ensures the TLB
is flushed when needed, regardless of whether the MMU can reuse a cached
root (or the last root).

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200320212833.3507-35-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/vmx/nested.c

index 34c015461c3563a2cc84ddf06da49f71c434b723..10fb9e7f1ecab2bfa99391401c61697f34aa7831 100644 (file)
@@ -5034,7 +5034,7 @@ void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly,
                kvm_calc_shadow_ept_root_page_role(vcpu, accessed_dirty,
                                                   execonly, level);
 
-       __kvm_mmu_new_cr3(vcpu, new_eptp, new_role.base, false, true);
+       __kvm_mmu_new_cr3(vcpu, new_eptp, new_role.base, true, true);
 
        if (new_role.as_u64 == context->mmu_role.as_u64)
                return;
index a8290954caa73dfba149a87f00fda1a323b4e155..237e2e32a6594023a02db04b1c3c4bea91e636e3 100644 (file)
@@ -1143,10 +1143,12 @@ static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool ne
        }
 
        /*
-        * See nested_vmx_transition_mmu_sync for details on skipping the MMU sync.
+        * Unconditionally skip the TLB flush on fast CR3 switch, all TLB
+        * flushes are handled by nested_vmx_transition_tlb_flush().  See
+        * nested_vmx_transition_mmu_sync for details on skipping the MMU sync.
         */
        if (!nested_ept)
-               kvm_mmu_new_cr3(vcpu, cr3, false,
+               kvm_mmu_new_cr3(vcpu, cr3, true,
                                !nested_vmx_transition_mmu_sync(vcpu));
 
        vcpu->arch.cr3 = cr3;