ia64/xen-unstable

changeset 12282:6f3c40ee2488

Enhance HVM xentrace:
1) VMX xentrace data are store in current vcpu instead physical CPU.
2) Log PIO data in xentrace.

Signed-off-by: Xin Li <xin.b.li@intel.com>
author kfraser@localhost.localdomain
date Tue Nov 07 10:48:48 2006 +0000 (2006-11-07)
parents 9febecbeaeb0
children 862aca401601
files xen/arch/x86/hvm/io.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/support.h xen/include/asm-x86/hvm/vcpu.h
line diff
     1.1 --- a/xen/arch/x86/hvm/io.c	Tue Nov 07 10:46:03 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/io.c	Tue Nov 07 10:48:48 2006 +0000
     1.3 @@ -406,6 +406,7 @@ static void hvm_pio_assist(struct cpu_us
     1.4              printk("Error: %s unknown port size\n", __FUNCTION__);
     1.5              domain_crash_synchronous();
     1.6          }
     1.7 +        TRACE_VMEXIT(3, regs->eax);
     1.8      }
     1.9  }
    1.10  
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Nov 07 10:46:03 2006 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Nov 07 10:48:48 2006 +0000
     2.3 @@ -47,9 +47,6 @@
     2.4  #include <asm/hvm/vlapic.h>
     2.5  #include <asm/x86_emulate.h>
     2.6  
     2.7 -static DEFINE_PER_CPU(unsigned long, trace_values[5]);
     2.8 -#define TRACE_VMEXIT(index,value) this_cpu(trace_values)[index]=value
     2.9 -
    2.10  static void vmx_ctxt_switch_from(struct vcpu *v);
    2.11  static void vmx_ctxt_switch_to(struct vcpu *v);
    2.12  
    2.13 @@ -1051,7 +1048,7 @@ static void vmx_io_instruction(unsigned 
    2.14      else
    2.15          port = regs->edx & 0xffff;
    2.16  
    2.17 -    TRACE_VMEXIT(1,port);
    2.18 +    TRACE_VMEXIT(1, port);
    2.19  
    2.20      size = (exit_qualification & 7) + 1;
    2.21      dir = test_bit(3, &exit_qualification); /* direction */
    2.22 @@ -1115,6 +1112,9 @@ static void vmx_io_instruction(unsigned 
    2.23          if ( port == 0xe9 && dir == IOREQ_WRITE && size == 1 )
    2.24              hvm_print_line(current, regs->eax); /* guest debug output */
    2.25  
    2.26 +        if ( dir == IOREQ_WRITE )
    2.27 +            TRACE_VMEXIT(2, regs->eax);
    2.28 +
    2.29          regs->eip += inst_len;
    2.30          send_pio_req(port, 1, size, regs->eax, dir, df, 0);
    2.31      }
    2.32 @@ -2317,12 +2317,13 @@ asmlinkage void vmx_vmexit_handler(struc
    2.33  
    2.34  asmlinkage void vmx_trace_vmentry(void)
    2.35  {
    2.36 +    struct vcpu *v = current;
    2.37      TRACE_5D(TRC_VMX_VMENTRY + current->vcpu_id,
    2.38 -             this_cpu(trace_values)[0],
    2.39 -             this_cpu(trace_values)[1],
    2.40 -             this_cpu(trace_values)[2],
    2.41 -             this_cpu(trace_values)[3],
    2.42 -             this_cpu(trace_values)[4]);
    2.43 +             v->arch.hvm_vcpu.hvm_trace_values[0],
    2.44 +             v->arch.hvm_vcpu.hvm_trace_values[1],
    2.45 +             v->arch.hvm_vcpu.hvm_trace_values[2],
    2.46 +             v->arch.hvm_vcpu.hvm_trace_values[3],
    2.47 +             v->arch.hvm_vcpu.hvm_trace_values[4]);
    2.48  
    2.49      TRACE_VMEXIT(0, 0);
    2.50      TRACE_VMEXIT(1, 0);
     3.1 --- a/xen/include/asm-x86/hvm/support.h	Tue Nov 07 10:46:03 2006 +0000
     3.2 +++ b/xen/include/asm-x86/hvm/support.h	Tue Nov 07 10:48:48 2006 +0000
     3.3 @@ -125,6 +125,9 @@ extern unsigned int opt_hvm_debug_level;
     3.4          domain_crash_synchronous();                             \
     3.5      } while (0)
     3.6  
     3.7 +#define TRACE_VMEXIT(index, value)                              \
     3.8 +    current->arch.hvm_vcpu.hvm_trace_values[index] = (value)
     3.9 +
    3.10  extern int hvm_enabled;
    3.11  
    3.12  int hvm_copy_to_guest_phys(paddr_t paddr, void *buf, int size);
     4.1 --- a/xen/include/asm-x86/hvm/vcpu.h	Tue Nov 07 10:46:03 2006 +0000
     4.2 +++ b/xen/include/asm-x86/hvm/vcpu.h	Tue Nov 07 10:48:48 2006 +0000
     4.3 @@ -47,6 +47,8 @@ struct hvm_vcpu {
     4.4      /* hlt ins emulation wakeup timer */
     4.5      struct timer        hlt_timer;
     4.6  
     4.7 +    unsigned long       hvm_trace_values[5];
     4.8 +
     4.9      union {
    4.10          struct arch_vmx_struct vmx;
    4.11          struct arch_svm_struct svm;