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

[Xen-changelog] [xen-unstable] x86 hvm: Add a hypercall to allow HVM PV drivers to insert xentrace records



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1278692201 -3600
# Node ID f2ce3467a4fbe943d082fe7b23e5c7108b02851a
# Parent  2662f9c881faaca6f1094049b4b8e1c5843685c2
x86 hvm: Add a hypercall to allow HVM PV drivers to insert xentrace records

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c          |   17 +++++++++++++++++
 xen/include/public/hvm/hvm_op.h |    9 +++++++++
 xen/include/public/trace.h      |    1 +
 3 files changed, 27 insertions(+)

diff -r 2662f9c881fa -r f2ce3467a4fb xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Jul 09 17:16:03 2010 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Fri Jul 09 17:16:41 2010 +0100
@@ -3197,6 +3197,23 @@ long do_hvm_op(unsigned long op, XEN_GUE
         break;
     }
 
+    case HVMOP_xentrace: {
+        xen_hvm_xentrace_t tr;
+
+        if ( copy_from_guest(&tr, arg, 1 ) )
+            return -EFAULT;
+
+        if ( tr.extra_bytes > sizeof(tr.extra)
+             || (tr.event & ~((1u<<TRC_SUBCLS_SHIFT)-1)) )
+            return -EINVAL;
+
+        /* Cycles will be taken at the vmexit and vmenter */
+        trace_var(tr.event | TRC_GUEST, 0 /*!cycles*/,
+                  tr.extra_bytes,
+                  (unsigned char *)tr.extra);
+        break;
+    }
+
     default:
     {
         gdprintk(XENLOG_WARNING, "Bad HVM op %ld.\n", op);
diff -r 2662f9c881fa -r f2ce3467a4fb xen/include/public/hvm/hvm_op.h
--- a/xen/include/public/hvm/hvm_op.h   Fri Jul 09 17:16:03 2010 +0100
+++ b/xen/include/public/hvm/hvm_op.h   Fri Jul 09 17:16:41 2010 +0100
@@ -22,6 +22,7 @@
 #define __XEN_PUBLIC_HVM_HVM_OP_H__
 
 #include "../xen.h"
+#include "../trace.h"
 
 /* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
 #define HVMOP_set_param           0
@@ -146,6 +147,14 @@ typedef struct xen_hvm_get_time xen_hvm_
 typedef struct xen_hvm_get_time xen_hvm_get_time_t;
 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_time_t);
 
+#define HVMOP_xentrace              11
+struct xen_hvm_xentrace {
+    uint16_t event, extra_bytes;
+    uint8_t extra[TRACE_EXTRA_MAX * sizeof(uint32_t)];
+};
+typedef struct xen_hvm_xentrace xen_hvm_xentrace_t;
+DEFINE_XEN_GUEST_HANDLE(xen_hvm_xentrace_t);
+
 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
 
 #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
diff -r 2662f9c881fa -r f2ce3467a4fb xen/include/public/trace.h
--- a/xen/include/public/trace.h        Fri Jul 09 17:16:03 2010 +0100
+++ b/xen/include/public/trace.h        Fri Jul 09 17:16:41 2010 +0100
@@ -39,6 +39,7 @@
 #define TRC_PV       0x0020f000    /* Xen PV traces            */
 #define TRC_SHADOW   0x0040f000    /* Xen shadow tracing       */
 #define TRC_PM       0x0080f000    /* Xen power management trace */
+#define TRC_GUEST    0x0800f000    /* Guest-generated traces   */
 #define TRC_ALL      0x0ffff000
 #define TRC_HD_TO_EVENT(x) ((x)&0x0fffffff)
 #define TRC_HD_CYCLE_FLAG (1UL<<31)

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