From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Huang Subject: [Patch][SVM]Disable intercepting CR3 writes when nested paging is enabled Date: Wed, 15 Jul 2009 15:34:36 -0500 Message-ID: <4A5E3D5C.1000702@amd.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070907060808030908090001" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "'xen-devel@lists.xensource.com'" List-Id: xen-devel@lists.xenproject.org --------------070907060808030908090001 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit 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 --------------070907060808030908090001 Content-Type: text/plain; name="npt_disable_intercept_cr3_write.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="npt_disable_intercept_cr3_write.txt" 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 --------------070907060808030908090001 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------070907060808030908090001--