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

[Xen-changelog] [xen-unstable] Tracing facility for nested virtualization



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1302789444 -3600
# Node ID b5165fb66b56d9438d77b475eaa9db67318d1ea1
# Parent  757460e1ec487a5c2b78e6f7d667db826fa5a4a0
Tracing facility for nested virtualization

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 757460e1ec48 -r b5165fb66b56 tools/xentrace/formats
--- a/tools/xentrace/formats    Thu Apr 14 14:54:24 2011 +0100
+++ b/tools/xentrace/formats    Thu Apr 14 14:57:24 2011 +0100
@@ -38,6 +38,9 @@
 0x00081001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VMENTRY
 0x00081002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VMEXIT      [ exitcode = 
0x%(1)08x, rIP  = 0x%(2)08x ]
 0x00081102  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  VMEXIT      [ exitcode = 
0x%(1)08x, rIP  = 0x%(3)08x%(2)08x ]
+0x00081401  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  nVMENTRY
+0x00081402  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  nVMEXIT     [ exitcode = 
0x%(1)08x, rIP  = 0x%(2)08x ]
+0x00081502  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  nVMEXIT     [ exitcode = 
0x%(1)08x, rIP  = 0x%(3)08x%(2)08x ]
 0x00082001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  PF_XEN      [ errorcode = 
0x%(2)02x, virt = 0x%(1)08x ]
 0x00082101  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  PF_XEN      [ errorcode = 
0x%(3)02x, virt = 0x%(2)08x%(1)08x ]
 0x00082002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  PF_INJECT   [ errorcode = 
0x%(1)02x, virt = 0x%(2)08x ]
diff -r 757460e1ec48 -r b5165fb66b56 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu Apr 14 14:54:24 2011 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Apr 14 14:57:24 2011 +0100
@@ -1668,6 +1668,17 @@
 
     exit_reason = vmcb->exitcode;
 
+    if ( hvm_long_mode_enabled(v) )
+        HVMTRACE_ND(VMEXIT64, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0,
+                    1/*cycles*/, 3, exit_reason,
+                    (uint32_t)regs->eip, (uint32_t)((uint64_t)regs->eip >> 32),
+                    0, 0, 0);
+    else
+        HVMTRACE_ND(VMEXIT, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0,
+                    1/*cycles*/, 2, exit_reason,
+                    (uint32_t)regs->eip,
+                    0, 0, 0, 0);
+
     if ( vcpu_guestmode ) {
         enum nestedhvm_vmexits nsret;
         struct nestedvcpu *nv = &vcpu_nestedhvm(v);
@@ -1728,15 +1739,6 @@
         }
     }
 
-    if ( hvm_long_mode_enabled(v) )
-        HVMTRACE_ND(VMEXIT64, 0, 1/*cycles*/, 3, exit_reason,
-                    (uint32_t)regs->eip, (uint32_t)((uint64_t)regs->eip >> 32),
-                    0, 0, 0);
-    else
-        HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, 2, exit_reason,
-                    (uint32_t)regs->eip, 
-                    0, 0, 0, 0);
-
     if ( unlikely(exit_reason == VMEXIT_INVALID) )
     {
         svm_vmcb_dump(__func__, vmcb);
@@ -2014,7 +2016,10 @@
 
 asmlinkage void svm_trace_vmentry(void)
 {
-    HVMTRACE_ND(VMENTRY, 0, 1/*cycles*/, 0, 0, 0, 0, 0, 0, 0);
+    struct vcpu *curr = current;
+    HVMTRACE_ND(VMENTRY,
+                nestedhvm_vcpu_in_guestmode(curr) ? TRC_HVM_NESTEDFLAG : 0,
+                1/*cycles*/, 0, 0, 0, 0, 0, 0, 0);
 }
   
 /*
diff -r 757460e1ec48 -r b5165fb66b56 xen/include/public/trace.h
--- a/xen/include/public/trace.h        Thu Apr 14 14:54:24 2011 +0100
+++ b/xen/include/public/trace.h        Thu Apr 14 14:57:24 2011 +0100
@@ -123,6 +123,7 @@
 #define TRC_SHADOW_RESYNC_ONLY                (TRC_SHADOW + 15)
 
 /* trace events per subclass */
+#define TRC_HVM_NESTEDFLAG      (0x400)
 #define TRC_HVM_VMENTRY         (TRC_HVM_ENTRYEXIT + 0x01)
 #define TRC_HVM_VMEXIT          (TRC_HVM_ENTRYEXIT + 0x02)
 #define TRC_HVM_VMEXIT64        (TRC_HVM_ENTRYEXIT + TRC_64_FLAG + 0x02)

_______________________________________________
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®.