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

[Xen-devel] [PATCH 16/17] vmx: nest: hvmtrace for nested



xentrace can now trace virtual vmexit and virtual vmentry
in a separate category.

Signed-off-by: Qing He <qing.he@xxxxxxxxx>

---
 tools/xentrace/formats          |    2 ++
 xen/arch/x86/hvm/vmx/nest.c     |   10 ++++++++++
 xen/include/asm-x86/hvm/trace.h |    3 +++
 xen/include/public/trace.h      |    4 ++++
 4 files changed, 19 insertions(+)

diff -r 7f54e6615e1e -r 3a7b55a0be9c tools/xentrace/formats
--- a/tools/xentrace/formats    Thu Apr 22 22:30:10 2010 +0800
+++ b/tools/xentrace/formats    Thu Apr 22 22:30:10 2010 +0800
@@ -70,6 +70,8 @@
 0x00082018  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  CLTS
 0x00082019  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  LMSW        [ value = 
0x%(1)08x ]
 0x00082119  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  LMSW        [ value = 
0x%(2)08x%(1)08x ]
+0x00083001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  NEST_ENTRY  [ entry_intr = 
0x%(1)08x, rIP  = 0x%(3)08x%(2)08x ]
+0x00083002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  NEST_EXIT   [ exitcode = 
0x%(1)08x, rIP  = 0x%(3)08x%(2)08x ]
 
 0x0010f001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_map      [ domid = 
%(1)d ]
 0x0010f002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_unmap    [ domid = 
%(1)d ]
diff -r 7f54e6615e1e -r 3a7b55a0be9c xen/arch/x86/hvm/vmx/nest.c
--- a/xen/arch/x86/hvm/vmx/nest.c       Thu Apr 22 22:30:10 2010 +0800
+++ b/xen/arch/x86/hvm/vmx/nest.c       Thu Apr 22 22:30:10 2010 +0800
@@ -888,6 +888,11 @@
 
     /* updating host cr0 to sync TS bit */
     __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0);
+
+    HVMTRACE_ND(NEST_ENTRY, 1/*cycles*/, 3,
+                __get_vvmcs(nest->vvmcs, VM_ENTRY_INTR_INFO),
+                (uint32_t)regs->rip, (uint32_t)((uint64_t)regs->rip >> 32),
+                0, 0, 0);
 }
 
 static void sync_vvmcs_guest_state(struct vmx_nest_struct *nest)
@@ -1026,6 +1031,11 @@
     /* updating host cr0 to sync TS bit */
     __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0);
 
+    HVMTRACE_ND(NEST_EXIT, 1/*cycles*/, 3,
+                __get_vvmcs(nest->vvmcs, VM_EXIT_REASON),
+                (uint32_t)regs->rip, (uint32_t)((uint64_t)regs->rip >> 32),
+                0, 0, 0);
+
     vmreturn(regs, VMSUCCEED);
 }
 
diff -r 7f54e6615e1e -r 3a7b55a0be9c xen/include/asm-x86/hvm/trace.h
--- a/xen/include/asm-x86/hvm/trace.h   Thu Apr 22 22:30:10 2010 +0800
+++ b/xen/include/asm-x86/hvm/trace.h   Thu Apr 22 22:30:10 2010 +0800
@@ -13,6 +13,7 @@
 #define DEFAULT_HVM_REGACCESS  DEFAULT_HVM_TRACE_ON
 #define DEFAULT_HVM_MISC       DEFAULT_HVM_TRACE_ON
 #define DEFAULT_HVM_INTR       DEFAULT_HVM_TRACE_ON
+#define DEFAULT_HVM_NEST       DEFAULT_HVM_TRACE_ON
 
 #define DO_TRC_HVM_VMENTRY     DEFAULT_HVM_VMSWITCH
 #define DO_TRC_HVM_VMEXIT      DEFAULT_HVM_VMSWITCH
@@ -49,6 +50,8 @@
 #define DO_TRC_HVM_CLTS        DEFAULT_HVM_MISC
 #define DO_TRC_HVM_LMSW        DEFAULT_HVM_MISC
 #define DO_TRC_HVM_LMSW64      DEFAULT_HVM_MISC
+#define DO_TRC_HVM_NEST_ENTRY  DEFAULT_HVM_NEST
+#define DO_TRC_HVM_NEST_EXIT   DEFAULT_HVM_NEST
 
 
 #ifdef __x86_64__
diff -r 7f54e6615e1e -r 3a7b55a0be9c xen/include/public/trace.h
--- a/xen/include/public/trace.h        Thu Apr 22 22:30:10 2010 +0800
+++ b/xen/include/public/trace.h        Thu Apr 22 22:30:10 2010 +0800
@@ -51,6 +51,7 @@
 /* trace subclasses for SVM */
 #define TRC_HVM_ENTRYEXIT 0x00081000   /* VMENTRY and #VMEXIT       */
 #define TRC_HVM_HANDLER   0x00082000   /* various HVM handlers      */
+#define TRC_HVM_NEST      0x00083000   /* nested virtualization     */
 
 #define TRC_SCHED_MIN       0x00021000   /* Just runstate changes */
 #define TRC_SCHED_CLASS     0x00022000   /* Scheduler-specific    */
@@ -161,6 +162,9 @@
 #define TRC_HVM_IOPORT_WRITE    (TRC_HVM_HANDLER + 0x216)
 #define TRC_HVM_IOMEM_WRITE     (TRC_HVM_HANDLER + 0x217)
 
+#define TRC_HVM_NEST_ENTRY      (TRC_HVM_NEST + 0x01)
+#define TRC_HVM_NEST_EXIT       (TRC_HVM_NEST + 0x02)
+
 /* trace subclasses for power management */
 #define TRC_PM_FREQ     0x00801000      /* xen cpu freq events */
 #define TRC_PM_IDLE     0x00802000      /* xen cpu idle events */

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


 


Rackspace

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