Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [LTTNG-MODULES PATCH] Export VMX KVM exit strings in statedump
@ 2010-09-15 15:34 Julien Desfossez
  2010-09-15 15:49 ` Mathieu Desnoyers
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Desfossez @ 2010-09-15 15:34 UTC (permalink / 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ltt-dev] [LTTNG-MODULES PATCH] Export VMX KVM exit strings in statedump
  2010-09-15 15:34 [ltt-dev] [LTTNG-MODULES PATCH] Export VMX KVM exit strings in statedump Julien Desfossez
@ 2010-09-15 15:49 ` Mathieu Desnoyers
  2010-09-15 16:38   ` [ltt-dev] [PATCH] " Julien Desfossez
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Desnoyers @ 2010-09-15 15:49 UTC (permalink / raw)


* Julien Desfossez (julien.desfossez at polymtl.ca) wrote:
> 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.

The idea is good, I'd just change the naming a bit:

I would introduce the channel

"enum_tables" instead of "string_state".

Also replace occurences of "string" or "strings" for something that
refers to an enumeration, e.g. "enum".

struct trace_strings -> struct trace_enum_map

Thoughts ?

Mathieu

> 
> 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
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ltt-dev] [PATCH] Export VMX KVM exit strings in statedump
  2010-09-15 15:49 ` Mathieu Desnoyers
@ 2010-09-15 16:38   ` Julien Desfossez
  0 siblings, 0 replies; 3+ messages in thread
From: Julien Desfossez @ 2010-09-15 16:38 UTC (permalink / 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 representation.
The new ltt_dump_enum_tables 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..8917d2f 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_enum_map {
+	long id;
+	const char *symbol;
+};
+
+#ifdef CONFIG_HAVE_KVM
+static const struct trace_enum_map vmx_kvm_exit_enum[] = {
+	{ 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_dump_enum_tables(struct ltt_probe_private_data *call_data)
+{
+#ifdef CONFIG_HAVE_KVM
+	int i;
+	/* KVM exit reasons for VMX */
+	for(i = 0; vmx_kvm_exit_enum[i].symbol; i++) {
+		__trace_mark(0, enum_tables, vmx_kvm_exit, call_data,
+				"id %ld symbol %s", vmx_kvm_exit_enum[i].id,
+				vmx_kvm_exit_enum[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_dump_enum_tables(call_data);
 
 	mutex_lock(&statedump_cb_mutex);
 
-- 
1.7.0.4





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-15 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-15 15:34 [ltt-dev] [LTTNG-MODULES PATCH] Export VMX KVM exit strings in statedump Julien Desfossez
2010-09-15 15:49 ` Mathieu Desnoyers
2010-09-15 16:38   ` [ltt-dev] [PATCH] " Julien Desfossez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox