debuggers.hg

changeset 19989:8368aff1d759

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@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jul 16 08:26:29 2009 +0100 (2009-07-16)
parents 06893fe1c399
children 1033c6cdec62
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Wed Jul 15 16:21:12 2009 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Thu Jul 16 08:26:29 2009 +0100
     1.3 @@ -1299,6 +1299,9 @@ asmlinkage void svm_vmexit_handler(struc
     1.4      eventinj_t eventinj;
     1.5      int inst_len, rc;
     1.6  
     1.7 +    if ( paging_mode_hap(v->domain) )
     1.8 +        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3] = vmcb->cr3;
     1.9 +
    1.10      /*
    1.11       * Before doing anything else, we need to sync up the VLAPIC's TPR with
    1.12       * SVM's vTPR. It's OK if the guest doesn't touch CR8 (e.g. 32-bit Windows)
     2.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Wed Jul 15 16:21:12 2009 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Thu Jul 16 08:26:29 2009 +0100
     2.3 @@ -235,11 +235,8 @@ static int construct_vmcb(struct vcpu *v
     2.4          vmcb->g_pat = 0x0007040600070406ULL; /* guest PAT */
     2.5          vmcb->h_cr3 = pagetable_get_paddr(v->domain->arch.phys_table);
     2.6  
     2.7 -        /*
     2.8 -         * No point in intercepting CR3 reads, because the hardware will return
     2.9 -         * the guest version anyway.
    2.10 -         */
    2.11 -        vmcb->cr_intercepts &= ~CR_INTERCEPT_CR3_READ;
    2.12 +        /* No point in intercepting CR3 reads/writes. */
    2.13 +        vmcb->cr_intercepts &= ~(CR_INTERCEPT_CR3_READ|CR_INTERCEPT_CR3_WRITE);
    2.14  
    2.15          /*
    2.16           * No point in intercepting INVLPG if we don't have shadow pagetables