From: Yang Zhang <yang.z.zhang@intel.com>
To: xen-devel@lists.xensource.com
Cc: Yang Zhang <yang.z.zhang@Intel.com>,
eddie.dong@intel.com, JBeulich@suse.com
Subject: [PATCH] VMX: Eliminate cr3 store/load vmexit when UG enabled
Date: Wed, 23 Oct 2013 15:39:05 +0800 [thread overview]
Message-ID: <1382513945-9479-1-git-send-email-yang.z.zhang@intel.com> (raw)
From: Yang Zhang <yang.z.zhang@Intel.com>
With the feature of unrestricted guest, there should no vmexit
be triggered when guest accesses the cr3 in non-paging mode.
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
---
xen/arch/x86/hvm/vmx/vmx.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 9ca8632..b9b5e74 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1086,7 +1086,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
CPU_BASED_CR3_STORE_EXITING);
v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
- if ( !hvm_paging_enabled(v) )
+ if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
v->arch.hvm_vmx.exec_control |= cr3_ctls;
/* Trap CR3 updates if CR3 memory events are enabled. */
@@ -1156,7 +1156,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
case 3:
if ( paging_mode_hap(v->domain) )
{
- if ( !hvm_paging_enabled(v) )
+ if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
v->arch.hvm_vcpu.hw_cr[3] =
v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
vmx_load_pdptrs(v);
@@ -2408,7 +2408,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
hvm_invalidate_regs_fields(regs);
- if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
+ if ( paging_mode_hap(v->domain) )
{
__vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
--
1.7.1
next reply other threads:[~2013-10-23 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 7:39 Yang Zhang [this message]
2013-10-23 14:40 ` [PATCH] VMX: Eliminate cr3 store/load vmexit when UG enabled Andrew Cooper
2013-10-24 4:41 ` Zhang, Yang Z
2013-10-28 13:22 ` Jan Beulich
2013-10-28 13:52 ` Andrew Cooper
2013-10-29 1:09 ` Zhang, Yang Z
2013-10-29 1:49 ` Nakajima, Jun
2013-10-29 1:02 ` Zhang, Yang Z
2013-10-29 7:42 ` Jan Beulich
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=1382513945-9479-1-git-send-email-yang.z.zhang@intel.com \
--to=yang.z.zhang@intel.com \
--cc=JBeulich@suse.com \
--cc=eddie.dong@intel.com \
--cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).