[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Enhance HVM xentrace:



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 6f3c40ee248856b84053adb9f6edfc5d31955684
# Parent  9febecbeaeb0aa9bd51ee654a7179fbcb49df343
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@xxxxxxxxx>
---
 xen/arch/x86/hvm/io.c             |    1 +
 xen/arch/x86/hvm/vmx/vmx.c        |   19 ++++++++++---------
 xen/include/asm-x86/hvm/support.h |    3 +++
 xen/include/asm-x86/hvm/vcpu.h    |    2 ++
 4 files changed, 16 insertions(+), 9 deletions(-)

diff -r 9febecbeaeb0 -r 6f3c40ee2488 xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c     Tue Nov 07 10:46:03 2006 +0000
+++ b/xen/arch/x86/hvm/io.c     Tue Nov 07 10:48:48 2006 +0000
@@ -406,6 +406,7 @@ static void hvm_pio_assist(struct cpu_us
             printk("Error: %s unknown port size\n", __FUNCTION__);
             domain_crash_synchronous();
         }
+        TRACE_VMEXIT(3, regs->eax);
     }
 }
 
diff -r 9febecbeaeb0 -r 6f3c40ee2488 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue Nov 07 10:46:03 2006 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Nov 07 10:48:48 2006 +0000
@@ -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 
     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 */
@@ -1114,6 +1111,9 @@ static void vmx_io_instruction(unsigned 
     } else {
         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(struc
 
 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);
diff -r 9febecbeaeb0 -r 6f3c40ee2488 xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Tue Nov 07 10:46:03 2006 +0000
+++ b/xen/include/asm-x86/hvm/support.h Tue Nov 07 10:48:48 2006 +0000
@@ -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);
diff -r 9febecbeaeb0 -r 6f3c40ee2488 xen/include/asm-x86/hvm/vcpu.h
--- a/xen/include/asm-x86/hvm/vcpu.h    Tue Nov 07 10:46:03 2006 +0000
+++ b/xen/include/asm-x86/hvm/vcpu.h    Tue Nov 07 10:48:48 2006 +0000
@@ -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;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.