[ltt-dev] [LTTNG-MODULES PATCH] Export VMX KVM exit strings in statedump

Mathieu Desnoyers compudj at krystal.dyndns.org
Wed Sep 15 11:49:36 EDT 2010


* 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




More information about the lttng-dev mailing list