WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 svm: Disable intercepting CR3 writes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 svm: Disable intercepting CR3 writes when nested paging is enabled
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Jul 2009 04:45:25 -0700
Delivery-date: Mon, 20 Jul 2009 04:45:47 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1247729189 -3600
# Node ID 8368aff1d759c48ea3904094089398c91c3fdc42
# Parent  06893fe1c39939e8363f99101b1eb89cd276f30b
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>
---
 xen/arch/x86/hvm/svm/svm.c  |    3 +++
 xen/arch/x86/hvm/svm/vmcb.c |    7 ++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff -r 06893fe1c399 -r 8368aff1d759 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Wed Jul 15 16:21:12 2009 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Jul 16 08:26:29 2009 +0100
@@ -1299,6 +1299,9 @@ asmlinkage void svm_vmexit_handler(struc
     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 06893fe1c399 -r 8368aff1d759 xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Wed Jul 15 16:21:12 2009 +0100
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Thu Jul 16 08:26:29 2009 +0100
@@ -235,11 +235,8 @@ static int construct_vmcb(struct vcpu *v
         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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 svm: Disable intercepting CR3 writes when nested paging is enabled, Xen patchbot-unstable <=