ia64/xen-unstable

changeset 15205:fe0499f6235c

svm: Replace call to svm_load_cr2 with conditional call to svm_trace_vmentry

Remove the call to svm_load_cr2 (which doesn't do anything useful).
The old svm_load_cr2 is now replaced with a svm_trace_vmentry. A call
to this function is done if "tb_init_done" is non-zero, so we don't call
this unless it's actually being used.

Signed-off-by: Mats Petersson <mats.petersson@amd.com>
author kfraser@localhost.localdomain
date Thu May 24 13:56:58 2007 +0100 (2007-05-24)
parents 8fcefab1d63b
children 6223d154e55f
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Thu May 24 13:45:47 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Thu May 24 13:56:58 2007 +0100
     1.3 @@ -2520,14 +2520,12 @@ asmlinkage void svm_vmexit_handler(struc
     1.4      }
     1.5  }
     1.6  
     1.7 -asmlinkage void svm_load_cr2(void)
     1.8 +asmlinkage void svm_trace_vmentry(void)
     1.9  {
    1.10      struct vcpu *v = current;
    1.11  
    1.12      /* This is the last C code before the VMRUN instruction. */
    1.13      HVMTRACE_0D(VMENTRY, v);
    1.14 -
    1.15 -    asm volatile ( "mov %0,%%cr2" : : "r" (v->arch.hvm_svm.cpu_cr2) );
    1.16  }
    1.17    
    1.18  /*
     2.1 --- a/xen/arch/x86/hvm/svm/x86_32/exits.S	Thu May 24 13:45:47 2007 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/x86_32/exits.S	Thu May 24 13:56:58 2007 +0100
     2.3 @@ -38,15 +38,22 @@
     2.4  ENTRY(svm_asm_do_resume)
     2.5          GET_CURRENT(%ebx)
     2.6          CLGI
     2.7 -        /* Run ASID stuff. */
     2.8 -        call svm_asid_handle_vmrun
     2.9  
    2.10          movl VCPU_processor(%ebx),%eax
    2.11          shl  $IRQSTAT_shift,%eax
    2.12          testl $~0,irq_stat(%eax,1)
    2.13          jnz  svm_process_softirqs
    2.14 +
    2.15 +        call svm_asid_handle_vmrun
    2.16          call svm_intr_assist
    2.17 -        call svm_load_cr2
    2.18 +
    2.19 +        /* Check if the trace buffer is initialized. 
    2.20 +         * Because the below condition is unlikely, we jump out of line
    2.21 +         * instead of having a mostly taken branch over the unlikely code.
    2.22 +         */
    2.23 +        cmpb $0,tb_init_done
    2.24 +        jnz  svm_trace
    2.25 +svm_trace_done:
    2.26  
    2.27          movl VCPU_svm_vmcb(%ebx),%ecx
    2.28          movl UREGS_eax(%esp),%eax
    2.29 @@ -89,3 +96,11 @@ svm_process_softirqs:
    2.30          STGI
    2.31          call do_softirq
    2.32          jmp  svm_asm_do_resume
    2.33 +
    2.34 +svm_trace:
    2.35 +        /* Call out to C, as this is not speed critical path
    2.36 +         * Note: svm_trace_vmentry will recheck the tb_init_done,
    2.37 +         * but this is on the slow path, so who cares 
    2.38 +         */
    2.39 +        call svm_trace_vmentry
    2.40 +        jmp  svm_trace_done
     3.1 --- a/xen/arch/x86/hvm/svm/x86_64/exits.S	Thu May 24 13:45:47 2007 +0100
     3.2 +++ b/xen/arch/x86/hvm/svm/x86_64/exits.S	Thu May 24 13:56:58 2007 +0100
     3.3 @@ -38,16 +38,23 @@
     3.4  ENTRY(svm_asm_do_resume)
     3.5          GET_CURRENT(%rbx)
     3.6          CLGI
     3.7 -        /* Run ASID stuff. */
     3.8 -        call svm_asid_handle_vmrun
     3.9  
    3.10          movl VCPU_processor(%rbx),%eax
    3.11          shl  $IRQSTAT_shift,%rax
    3.12          leaq irq_stat(%rip),%rdx
    3.13          testl $~0,(%rdx,%rax,1)
    3.14          jnz  svm_process_softirqs
    3.15 +
    3.16 +        call svm_asid_handle_vmrun
    3.17          call svm_intr_assist
    3.18 -        call svm_load_cr2
    3.19 +
    3.20 +        /* Check if the trace buffer is initialized. 
    3.21 +         * Because the below condition is unlikely, we jump out of line
    3.22 +         * instead of having a mostly taken branch over the unlikely code.
    3.23 +         */
    3.24 +        cmpb $0,tb_init_done(%rip)
    3.25 +        jnz  svm_trace
    3.26 +svm_trace_done:
    3.27  
    3.28          movq VCPU_svm_vmcb(%rbx),%rcx
    3.29          movq UREGS_rax(%rsp),%rax
    3.30 @@ -106,3 +113,11 @@ svm_process_softirqs:
    3.31          STGI
    3.32          call do_softirq
    3.33          jmp  svm_asm_do_resume
    3.34 +
    3.35 +svm_trace:
    3.36 +        /* Call out to C, as this is not speed critical path
    3.37 +         * Note: svm_trace_vmentry will recheck the tb_init_done,
    3.38 +         * but this is on the slow path, so who cares 
    3.39 +         */
    3.40 +        call svm_trace_vmentry
    3.41 +        jmp  svm_trace_done