From: Davidlohr Bueso <dave@gnu.org>
To: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Sheng Yang <sheng.yang@intel.com>
Cc: KVM <kvm@vger.kernel.org>, lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] KVM: VMX: call invvpid only when EPT is disabled
Date: Thu, 15 Mar 2012 02:44:44 +0100 [thread overview]
Message-ID: <1331775884.20336.2.camel@offbook> (raw)
From: Davidlohr Bueso <dave@gnu.org>
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 <dave@gnu.org>
---
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
next reply other threads:[~2012-03-15 1:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-15 1:44 Davidlohr Bueso [this message]
2012-03-15 9:53 ` [PATCH] KVM: VMX: call invvpid only when EPT is disabled Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331775884.20336.2.camel@offbook \
--to=dave@gnu.org \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=sheng.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox