From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xensource.com
Cc: David Vrabel <david.vrabel@citrix.com>,
George Dunlap <george.dunlap@citrix.com>
Subject: [PATCH 1/2] trace: improve usefulness of hypercall trace record
Date: Thu, 24 May 2012 11:37:08 +0100 [thread overview]
Message-ID: <1337855829-15683-2-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1337855829-15683-1-git-send-email-david.vrabel@citrix.com>
From: David Vrabel <david.vrabel@citrix.com>
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 (the number of calls in
a multicall, and the number of PTE updates in an mmu_update).
To allow tracing tools to distinguish between the two formats, the new
format uses a new event ID (TRC_PV_HYPERCALL_V2).
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
xen/arch/x86/trace.c | 33 +++++++++++++--------------------
xen/common/trace.c | 23 +++++++++++++++++++++++
xen/include/public/trace.h | 1 +
xen/include/xen/trace.h | 2 ++
4 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/xen/arch/x86/trace.c b/xen/arch/x86/trace.c
index 404f293..2b59017 100644
--- a/xen/arch/x86/trace.c
+++ b/xen/arch/x86/trace.c
@@ -14,35 +14,28 @@
void trace_hypercall(void)
{
struct cpu_user_regs *regs = guest_cpu_user_regs();
+ unsigned long args[5];
#ifdef __x86_64__
if ( is_pv_32on64_vcpu(current) )
{
- struct {
- u32 eip,eax;
- } __attribute__((packed)) d;
-
- d.eip = regs->eip;
- d.eax = regs->eax;
-
- __trace_var(TRC_PV_HYPERCALL, 1, sizeof(d), &d);
+ args[0] = regs->ebx;
+ args[1] = regs->ecx;
+ args[2] = regs->edx;
+ args[3] = regs->esi;
+ args[4] = regs->edi;
}
else
#endif
{
- struct {
- unsigned long eip;
- u32 eax;
- } __attribute__((packed)) d;
- u32 event;
-
- event = TRC_PV_HYPERCALL;
- event |= TRC_64_FLAG;
- d.eip = regs->eip;
- d.eax = regs->eax;
-
- __trace_var(event, 1/*tsc*/, sizeof(d), &d);
+ args[0] = regs->rdi;
+ args[1] = regs->rsi;
+ args[2] = regs->rdx;
+ args[3] = regs->r10;
+ args[4] = regs->r11;
}
+
+ __trace_hypercall(regs->eax, args);
}
void __trace_pv_trap(int trapnr, unsigned long eip,
diff --git a/xen/common/trace.c b/xen/common/trace.c
index cacaeb2..47c9a6a 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -816,6 +816,29 @@ unlock:
tasklet_schedule(&trace_notify_dom0_tasklet);
}
+void __trace_hypercall(unsigned long op, const unsigned long *args)
+{
+ struct {
+ uint32_t op;
+ uint32_t args[5];
+ } __attribute__((packed)) d;
+ uint32_t *a = d.args;
+
+ d.op = op;
+
+ switch (op) {
+ case __HYPERVISOR_multicall:
+ *a++ = args[1]; /* count */
+ break;
+ case __HYPERVISOR_mmu_update:
+ *a++ = args[1]; /* count */
+ break;
+ }
+
+ __trace_var(TRC_PV_HYPERCALL_V2, 1,
+ sizeof(uint32_t) * (1 + (a - d.args)), &d);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h
index 0dfabe9..38a3f83 100644
--- a/xen/include/public/trace.h
+++ b/xen/include/public/trace.h
@@ -106,6 +106,7 @@
#define TRC_PV_GDT_LDT_MAPPING_FAULT (TRC_PV + 10)
#define TRC_PV_PTWR_EMULATION (TRC_PV + 11)
#define TRC_PV_PTWR_EMULATION_PAE (TRC_PV + 12)
+#define TRC_PV_HYPERCALL_V2 (TRC_PV + 14)
/* Indicates that addresses in trace record are 64 bits */
#define TRC_64_FLAG (0x100)
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index b32f6c5..f601aeb 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -44,6 +44,8 @@ static inline void trace_var(u32 event, int cycles, int extra,
__trace_var(event, cycles, extra, extra_data);
}
+void __trace_hypercall(unsigned long call, const unsigned long *args);
+
/* Convenience macros for calling the trace function. */
#define TRACE_0D(_e) \
do { \
--
1.7.2.5
next prev parent reply other threads:[~2012-05-24 10:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-24 10:37 [PATCH 0/2] trace: improve hypercall tracing David Vrabel
2012-05-24 10:37 ` David Vrabel [this message]
2012-05-24 16:11 ` [PATCH 1/2] trace: improve usefulness of hypercall trace record George Dunlap
2012-05-24 16:14 ` David Vrabel
2012-05-28 16:03 ` Frediano Ziglio
2012-05-28 16:07 ` David Vrabel
2012-05-24 10:37 ` [PATCH 2/2] trace: trace hypercalls inside a multicall David Vrabel
2012-05-28 16:03 ` Frediano Ziglio
2012-05-28 16:09 ` David Vrabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337855829-15683-2-git-send-email-david.vrabel@citrix.com \
--to=david.vrabel@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).