Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: julien.desfossez@polymtl.ca (Julien Desfossez)
Subject: [ltt-dev] [LTTNG-MODULES PATCH] Export VMX KVM exit strings in statedump
Date: Wed, 15 Sep 2010 11:34:49 -0400	[thread overview]
Message-ID: <1284564889-28684-1-git-send-email-julien.desfossez@polymtl.ca> (raw)

During the statedump, if the kernel has KVM compiled in, the exit
reasons for VMX KVM are exported. That way the analyzer can match the
exit reason id with a more explicit string.
The new ltt_enumerate_strings function aims to provide a generic way to
export strings in the traces when necessary.

Signed-off-by: Julien Desfossez <julien.desfossez at polymtl.ca>
---
 ltt-statedump.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/ltt-statedump.c b/ltt-statedump.c
index 06ade69..d5b18f2 100644
--- a/ltt-statedump.c
+++ b/ltt-statedump.c
@@ -39,6 +39,10 @@
 #include <linux/irq.h>
 #endif
 
+#ifdef CONFIG_HAVE_KVM
+#include <asm/vmx.h>
+#endif
+
 #define NB_PROC_CHUNK 20
 
 /*
@@ -85,6 +89,49 @@ enum lttng_process_status {
 	LTTNG_DEAD = 7,
 };
 
+struct trace_strings {
+	long id;
+	const char *symbol;
+};
+
+#ifdef CONFIG_HAVE_KVM
+static const struct trace_strings vmx_kvm_exit_strings[] = {
+	{ EXIT_REASON_EXCEPTION_NMI,           "exception" },
+	{ EXIT_REASON_EXTERNAL_INTERRUPT,      "ext_irq" },
+	{ EXIT_REASON_TRIPLE_FAULT,            "triple_fault" },
+	{ EXIT_REASON_NMI_WINDOW,              "nmi_window" },
+	{ EXIT_REASON_IO_INSTRUCTION,          "io_instruction" },
+	{ EXIT_REASON_CR_ACCESS,               "cr_access" },
+	{ EXIT_REASON_DR_ACCESS,               "dr_access" },
+	{ EXIT_REASON_CPUID,                   "cpuid" },
+	{ EXIT_REASON_MSR_READ,                "rdmsr" },
+	{ EXIT_REASON_MSR_WRITE,               "wrmsr" },
+	{ EXIT_REASON_PENDING_INTERRUPT,       "interrupt_window" },
+	{ EXIT_REASON_HLT,                     "halt" },
+	{ EXIT_REASON_INVLPG,                  "invlpg" },
+	{ EXIT_REASON_VMCALL,                  "hypercall" },
+	{ EXIT_REASON_TPR_BELOW_THRESHOLD,     "tpr_below_thres" },
+	{ EXIT_REASON_APIC_ACCESS,             "apic_access" },
+	{ EXIT_REASON_WBINVD,                  "wbinvd" },
+	{ EXIT_REASON_TASK_SWITCH,             "task_switch" },
+	{ EXIT_REASON_EPT_VIOLATION,           "ept_violation" },
+	{ -1, NULL }
+};
+#endif /* CONFIG_HAVE_KVM */
+
+static void ltt_enumerate_strings(struct ltt_probe_private_data *call_data)
+{
+#ifdef CONFIG_HAVE_KVM
+	int i;
+	/* KVM exit strings for VMX */
+	for(i = 0; vmx_kvm_exit_strings[i].symbol; i++) {
+		__trace_mark(0, string_state, vmx_kvm_exit, call_data,
+				"id %ld symbol %s", vmx_kvm_exit_strings[i].id,
+				vmx_kvm_exit_strings[i].symbol);
+	}
+#endif /* CONFIG_HAVE_KVM */
+}
+
 #ifdef CONFIG_INET
 static void ltt_enumerate_device(struct ltt_probe_private_data *call_data,
 				 struct net_device *dev)
@@ -374,6 +421,7 @@ static int do_ltt_statedump(struct ltt_probe_private_data *call_data)
 	ltt_dump_sys_call_table(call_data);
 	ltt_dump_softirq_vec(call_data);
 	ltt_dump_idt_table(call_data);
+	ltt_enumerate_strings(call_data);
 
 	mutex_lock(&statedump_cb_mutex);
 
-- 
1.7.0.4





             reply	other threads:[~2010-09-15 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 15:34 Julien Desfossez [this message]
2010-09-15 15:49 ` Mathieu Desnoyers
2010-09-15 16:38   ` [ltt-dev] [PATCH] " Julien Desfossez

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=1284564889-28684-1-git-send-email-julien.desfossez@polymtl.ca \
    --to=julien.desfossez@polymtl.ca \
    /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