From mboxrd@z Thu Jan 1 00:00:00 1970 From: Davidlohr Bueso Subject: [PATCH] KVM: VMX: call invvpid only when EPT is disabled Date: Thu, 15 Mar 2012 02:44:44 +0100 Message-ID: <1331775884.20336.2.camel@offbook> Reply-To: dave@gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: KVM , lkml To: Avi Kivity , Marcelo Tosatti , Sheng Yang Return-path: Received: from caiajhbdcaid.dreamhost.com ([208.97.132.83]:46505 "EHLO homiemail-a7.g.dreamhost.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031223Ab2COBos (ORCPT ); Wed, 14 Mar 2012 21:44:48 -0400 Sender: kvm-owner@vger.kernel.org List-ID: From: Davidlohr Bueso With EPT enabled it is not required to explicitly run invvpid to invalidate tagged TLB entries, as KVM does not force vm-exits for cr3 writes and invlpg. Run invvpid only when these instructions are emulated and shadow pages are used. Signed-off-by: Davidlohr Bueso --- arch/x86/kvm/vmx.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2c22fc7..51c7fb9 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2861,12 +2861,13 @@ static void exit_lmode(struct kvm_vcpu *vcpu) static void vmx_flush_tlb(struct kvm_vcpu *vcpu) { - vpid_sync_context(to_vmx(vcpu)); 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(to_vmx(vcpu)); } static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu) -- 1.7.4.1