From: Jim Mattson Subject: [PATCH] kvm: vmx: Don't use INVVPID when EPT is enabled Date: Wed, 15 Mar 2017 07:56:11 -0700 Message-ID: <20170315145611.16880-1-jmattson@google.com> Cc: Jim Mattson To: kvm@vger.kernel.org Return-path: Received: from mail-pg0-f52.google.com ([74.125.83.52]:34832 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbdCOO4a (ORCPT ); Wed, 15 Mar 2017 10:56:30 -0400 Received: by mail-pg0-f52.google.com with SMTP id b129so10276564pgc.2 for ; Wed, 15 Mar 2017 07:56:30 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: According to the Intel SDM, volume 3, section 28.3.2: Creating and Using Cached Translation Information, "No linear mappings are used while EPT is in use." INVEPT will invalidate both the guest-physical mappings and the combined mappings in the TLBs and paging-structure caches, so an INVVPID is superfluous. Signed-off-by: Jim Mattson --- arch/x86/kvm/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2c21181c8a70..114f358b959c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4011,11 +4011,12 @@ static void exit_lmode(struct kvm_vcpu *vcpu) static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid) { - vpid_sync_context(vpid); if (enable_ept) { if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) return; ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); + } else { + vpid_sync_context(vpid); } } -- 2.12.0.367.g23dc2f6d3c-goog