Enhance HVM xentrace:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 7 Nov 2006 10:48:48 +0000 (10:48 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 7 Nov 2006 10:48:48 +0000 (10:48 +0000)
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>
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

index f5c13d131bc28eea2faa9cc636e971a7c39f4003..a56ac433311fa3a0205fdc6c4c1b667c10c29847 100644 (file)
@@ -406,6 +406,7 @@ static void hvm_pio_assist(struct cpu_user_regs *regs, ioreq_t *p,
             printk("Error: %s unknown port size\n", __FUNCTION__);
             domain_crash_synchronous();
         }
+        TRACE_VMEXIT(3, regs->eax);
     }
 }
 
index ca0bfbde75da29fc0ccff9f7a035ce5d1d71bb42..06c0ca71b8d82de38ffda49213691504ded19731 100644 (file)
@@ -47,9 +47,6 @@
 #include <asm/hvm/vlapic.h>
 #include <asm/x86_emulate.h>
 
-static DEFINE_PER_CPU(unsigned long, trace_values[5]);
-#define TRACE_VMEXIT(index,value) this_cpu(trace_values)[index]=value
-
 static void vmx_ctxt_switch_from(struct vcpu *v);
 static void vmx_ctxt_switch_to(struct vcpu *v);
 
@@ -1051,7 +1048,7 @@ static void vmx_io_instruction(unsigned long exit_qualification,
     else
         port = regs->edx & 0xffff;
 
-    TRACE_VMEXIT(1,port);
+    TRACE_VMEXIT(1, port);
 
     size = (exit_qualification & 7) + 1;
     dir = test_bit(3, &exit_qualification); /* direction */
@@ -1115,6 +1112,9 @@ static void vmx_io_instruction(unsigned long exit_qualification,
         if ( port == 0xe9 && dir == IOREQ_WRITE && size == 1 )
             hvm_print_line(current, regs->eax); /* guest debug output */
 
+        if ( dir == IOREQ_WRITE )
+            TRACE_VMEXIT(2, regs->eax);
+
         regs->eip += inst_len;
         send_pio_req(port, 1, size, regs->eax, dir, df, 0);
     }
@@ -2317,12 +2317,13 @@ asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
 
 asmlinkage void vmx_trace_vmentry(void)
 {
+    struct vcpu *v = current;
     TRACE_5D(TRC_VMX_VMENTRY + current->vcpu_id,
-             this_cpu(trace_values)[0],
-             this_cpu(trace_values)[1],
-             this_cpu(trace_values)[2],
-             this_cpu(trace_values)[3],
-             this_cpu(trace_values)[4]);
+             v->arch.hvm_vcpu.hvm_trace_values[0],
+             v->arch.hvm_vcpu.hvm_trace_values[1],
+             v->arch.hvm_vcpu.hvm_trace_values[2],
+             v->arch.hvm_vcpu.hvm_trace_values[3],
+             v->arch.hvm_vcpu.hvm_trace_values[4]);
 
     TRACE_VMEXIT(0, 0);
     TRACE_VMEXIT(1, 0);
index 440cbfee6926825a85e989d2d8aad372e5e816f1..f9ab090dfe1f7c914650fb06ba003fa153d08a88 100644 (file)
@@ -125,6 +125,9 @@ extern unsigned int opt_hvm_debug_level;
         domain_crash_synchronous();                             \
     } while (0)
 
+#define TRACE_VMEXIT(index, value)                              \
+    current->arch.hvm_vcpu.hvm_trace_values[index] = (value)
+
 extern int hvm_enabled;
 
 int hvm_copy_to_guest_phys(paddr_t paddr, void *buf, int size);
index f613ae6a09d55529487766fe2b9a0187fd51301a..8945916d3208abee3204f7d2e7a60c02b7745309 100644 (file)
@@ -47,6 +47,8 @@ struct hvm_vcpu {
     /* hlt ins emulation wakeup timer */
     struct timer        hlt_timer;
 
+    unsigned long       hvm_trace_values[5];
+
     union {
         struct arch_vmx_struct vmx;
         struct arch_svm_struct svm;