[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.4-testing] x86 svm: Disable intercepting CR3 writes when nested paging is enabled



# HG changeset patch
# User Keith Coleman <keith.coleman@xxxxxxxxxxxxx>
# Date 1324425861 18000
# Node ID cff42b139dcccfb33056fae56ed9b78ca79f0f86
# Parent  985c41cd52dad9fd77e111904ffdfd71cea39036
x86 svm: Disable intercepting CR3 writes when nested paging is enabled

This patch disables intercepting CR3 writes when nested paging is
enabled. For
applications which cause excessive CR3 accesses, the patch can increase
their
performance.

Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
---


diff -r 985c41cd52da -r cff42b139dcc xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Tue Dec 20 19:03:38 2011 -0500
+++ b/xen/arch/x86/hvm/svm/svm.c        Tue Dec 20 19:04:21 2011 -0500
@@ -1281,6 +1281,9 @@
     eventinj_t eventinj;
     int inst_len, rc;
 
+    if ( paging_mode_hap(v->domain) )
+        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3] = vmcb->cr3;
+
     /*
      * Before doing anything else, we need to sync up the VLAPIC's TPR with
      * SVM's vTPR. It's OK if the guest doesn't touch CR8 (e.g. 32-bit Windows)
diff -r 985c41cd52da -r cff42b139dcc xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Tue Dec 20 19:03:38 2011 -0500
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Tue Dec 20 19:04:21 2011 -0500
@@ -230,11 +230,8 @@
         vmcb->g_pat = 0x0007040600070406ULL; /* guest PAT */
         vmcb->h_cr3 = pagetable_get_paddr(v->domain->arch.phys_table);
 
-        /*
-         * No point in intercepting CR3 reads, because the hardware will return
-         * the guest version anyway.
-         */
-        vmcb->cr_intercepts &= ~CR_INTERCEPT_CR3_READ;
+        /* No point in intercepting CR3 reads/writes. */
+        vmcb->cr_intercepts &= ~(CR_INTERCEPT_CR3_READ|CR_INTERCEPT_CR3_WRITE);
 
         /*
          * No point in intercepting INVLPG if we don't have shadow pagetables

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.