aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/trace.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2012-10-03 11:11:06 +0100
committerDavid Vrabel <david.vrabel@citrix.com>2012-10-03 11:11:06 +0100
commit86b35acb001f977eb1f82df6c07edaef173f4232 (patch)
treea3c9bf5a4638b702a19a7b9ac630a1550d83883b /xen/common/trace.c
parent4e6967a47ad4caa3af3ada3045fb278a53fd202b (diff)
downloadxen-86b35acb001f977eb1f82df6c07edaef173f4232.tar.gz
xen-86b35acb001f977eb1f82df6c07edaef173f4232.tar.bz2
xen-86b35acb001f977eb1f82df6c07edaef173f4232.zip
trace: improve usefulness of hypercall trace record
Trace hypercalls using a more useful trace record format. The EIP field is removed (it was always somewhere in the hypercall page) and include selected hypercall arguments (e.g., the number of calls in a multicall, and the number of PTE updates in an mmu_update etc.). 12 bits in the first extra word are used to indicate which arguments are present in the record and what size they are (32 or 64-bit). This is an incompatible record format so a new event ID is used so tools can distinguish between the two formats. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: George Dunlap <george.dunlap@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/trace.c')
-rw-r--r--xen/common/trace.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/xen/common/trace.c b/xen/common/trace.c
index cacaeb2656..57a5a36014 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -816,6 +816,58 @@ unlock:
tasklet_schedule(&trace_notify_dom0_tasklet);
}
+void __trace_hypercall(unsigned long op, const unsigned long *args)
+{
+ struct {
+ uint32_t op;
+ uint32_t args[6];
+ } __attribute__((packed)) d;
+ uint32_t *a = d.args;
+
+#define APPEND_ARG32(i) \
+ do { \
+ unsigned i_ = (i); \
+ *a++ = args[(i_)]; \
+ d.op |= TRC_PV_HYPERCALL_V2_ARG_32(i_); \
+ } while( 0 )
+
+ /*
+ * This shouldn't happen as @op should be small enough but just in
+ * case, warn if the argument bits in the trace record would
+ * clobber the hypercall op.
+ */
+ WARN_ON(op & TRC_PV_HYPERCALL_V2_ARG_MASK);
+
+ d.op = op;
+
+ switch ( op )
+ {
+ case __HYPERVISOR_mmu_update:
+ APPEND_ARG32(1); /* count */
+ break;
+ case __HYPERVISOR_multicall:
+ APPEND_ARG32(1); /* count */
+ break;
+ case __HYPERVISOR_grant_table_op:
+ APPEND_ARG32(0); /* cmd */
+ APPEND_ARG32(2); /* count */
+ break;
+ case __HYPERVISOR_vcpu_op:
+ APPEND_ARG32(0); /* cmd */
+ APPEND_ARG32(1); /* vcpuid */
+ break;
+ case __HYPERVISOR_mmuext_op:
+ APPEND_ARG32(1); /* count */
+ break;
+ case __HYPERVISOR_sched_op:
+ APPEND_ARG32(0); /* cmd */
+ break;
+ }
+
+ __trace_var(TRC_PV_HYPERCALL_V2, 1,
+ sizeof(uint32_t) * (1 + (a - d.args)), &d);
+}
+
/*
* Local variables:
* mode: C