All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Huang <wei.huang2@amd.com>
To: "'xen-devel@lists.xensource.com'" <xen-devel@lists.xensource.com>
Subject: [Patch][SVM]Disable intercepting CR3 writes when nested paging is enabled
Date: Wed, 15 Jul 2009 15:34:36 -0500	[thread overview]
Message-ID: <4A5E3D5C.1000702@amd.com> (raw)
In-Reply-To: <C683CC61.FA1D%keir.fraser@eu.citrix.com>

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

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

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

[-- Attachment #2: npt_disable_intercept_cr3_write.txt --]
[-- Type: text/plain, Size: 1294 bytes --]

diff -r c31edc59ae5d xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Sat Jul 25 19:31:35 2009 -0500
+++ b/xen/arch/x86/hvm/svm/svm.c	Sat Jul 25 19:31:51 2009 -0500
@@ -1299,6 +1299,8 @@ 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 c31edc59ae5d xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c	Sat Jul 25 19:31:35 2009 -0500
+++ b/xen/arch/x86/hvm/svm/vmcb.c	Sat Jul 25 19:31:51 2009 -0500
@@ -236,10 +236,10 @@ static int construct_vmcb(struct vcpu *v
         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.
+         * No point in intercepting CR3 reads/writes
          */
         vmcb->cr_intercepts &= ~CR_INTERCEPT_CR3_READ;
+        vmcb->cr_intercepts &= ~CR_INTERCEPT_CR3_WRITE;
 
         /*
          * No point in intercepting INVLPG if we don't have shadow pagetables

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2009-07-15 20:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15 16:01 Latest xen-3.4-testing hangs on boot with iommu=1, on a Lenovo T500 Tom Rotenberg
2009-07-15 16:58 ` Keir Fraser
2009-07-15 17:03   ` Tom Rotenberg
2009-07-15 17:11     ` Keir Fraser
2009-07-15 20:34       ` Wei Huang [this message]
2009-07-16  8:26       ` Tom Rotenberg
2009-07-16  9:54         ` Tom Rotenberg
2009-07-16 10:00           ` Keir Fraser
2009-07-16 10:03             ` Tom Rotenberg
2009-07-16 10:10               ` Keir Fraser
2009-07-16 10:14                 ` Tom Rotenberg
2009-07-16 10:18                   ` Tom Rotenberg
2009-07-16 12:08     ` Cui, Dexuan
2009-07-16 12:13       ` Tom Rotenberg

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=4A5E3D5C.1000702@amd.com \
    --to=wei.huang2@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.