perf/core improvements and fixes
hi Ingo,
please consider pulling
thanks,
jirka
The following changes since commit 4ba96195051be30160af6d5f5f83f9a055ab1f23:
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core (2014-06-13 08:19:06 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git tags/perf-core-for-mingo
for you to fetch changes up to 1545d8aca9ac1cb3f503fb9c29543d539d99c7af:
tools lib traceevent: Clean up format of args in jbd2 plugin (2014-06-19 18:18:37 +0200)
----------------------------------------------------------------
perf/core improvements and fixes:
. Updates from trace-cmd for traceevent plugin_kvm plus args cleanup (Steven Rostedt, Jan Kiszka)
----------------------------------------------------------------
Jan Kiszka (3):
tools lib traceevent: Report unknown VMX exit reasons with code tools lib traceevent: Factor out print_exit_reason in kvm plugin tools lib traceevent: Fix and cleanup kvm_nested_vmexit tracepoints
Steven Rostedt (3):
tools lib traceevent: Fix format in plugin_kvm
tools lib traceevent: Clean up format of args in cfg80211 plugin tools lib traceevent: Clean up format of args in jbd2 plugin
Steven Rostedt (Red Hat) (1):
tools lib traceevent: Add back in kvm plugins nested_vmexit events
tools/lib/traceevent/plugin_cfg80211.c | 3 +- tools/lib/traceevent/plugin_jbd2.c | 6 ++-- tools/lib/traceevent/plugin_kvm.c | 64 +++++++++++++++++++++++++++++----- 3 files changed, 59 insertions(+), 14 deletions(-)
PATCH 1/7 tools lib traceevent: Report unknown VMX exit reasons with code
From: Jan Kiszka <[email protected]>
Allows to parse the result even if the KVM plugin does not yet understand a specific exit code.
--- tools/lib/traceevent/plugin_kvm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
tools/lib/traceevent/plugin_kvm.c +8 -4
@@ -240,9 +240,8 @@ static const char *find_exit_reason(unsigned isa, int val)for (i =0 ; strings[i].val >=0 ; i++)if (strings[i].val == val)break ; -if (strings[i].str) -return strings[i].str; -return "UNKNOWN" ; + +return strings[i].str; } static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
@@ -251,6 +250,7 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,unsigned long long isa;unsigned long long val;unsigned long long info1 =0 , info2 =0 ; +const char *reason;if (pevent_get_field_val (s, event,"exit_reason" , record, &val,1 ) <0 )return -1 ;
@@ -258,7 +258,11 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,if (pevent_get_field_val (s, event,"isa" , record, &isa,0 ) <0 ) isa =1 ; -trace_seq_printf (s,"reason %s" ,find_exit_reason (isa, val)); + reason =find_exit_reason (isa, val); +if (reason) +trace_seq_printf (s,"reason %s" , reason); +else +trace_seq_printf (s,"reason UNKNOWN (%llu)" , val);pevent_print_num_field (s," rip 0x%lx" , event,"guest_rip" , record,1 );
Signature · 1 line
1.8.3.1
PATCH 2/7 tools lib traceevent: Factor out print_exit_reason in kvm plugin
In reply to Jiri OlsaFrom: Jan Kiszka <[email protected]>
We will reuse it for nested vmexit tracepoints.
--- tools/lib/traceevent/plugin_kvm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
tools/lib/traceevent/plugin_kvm.c +13 -4
@@ -244,15 +244,14 @@ static const char *find_exit_reason(unsigned isa, int val)return strings[i].str; } -static int kvm_exit_handler (struct trace_seq *s,struct pevent_record *record, -struct event_format *event,void *context) +static int print_exit_reason (struct trace_seq *s,struct pevent_record *record, +struct event_format *event,const char *field) {unsigned long long isa;unsigned long long val; -unsigned long long info1 =0 , info2 =0 ;const char *reason; -if (pevent_get_field_val (s, event,"exit_reason" , record, &val,1 ) <0 ) +if (pevent_get_field_val (s, event, field, record, &val,1 ) <0 )return -1 ;if (pevent_get_field_val (s, event,"isa" , record, &isa,0 ) <0 )
@@ -263,6 +262,16 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,trace_seq_printf (s,"reason %s" , reason); else trace_seq_printf(s, "reason UNKNOWN (%llu)", val); +return 0 ; +} + +static int kvm_exit_handler (struct trace_seq *s,struct pevent_record *record, +struct event_format *event,void *context) +{ +unsigned long long info1 =0 , info2 =0 ; + +if (print_exit_reason (s, record, event,"exit_reason" ) <0 ) +return -1 ;pevent_print_num_field (s," rip 0x%lx" , event,"guest_rip" , record,1 );
Signature · 1 line
1.8.3.1
PATCH 3/7 tools lib traceevent: Add back in kvm plugins nested_vmexit events
In reply to Jiri OlsaFrom: "Steven Rostedt (Red Hat)" <[email protected]>
The nested vmexit events were removed from the backport from trace-cmd because they were considered buggy. They have since been updated in trace-cmd but are still missing from the traceevent library. Add back in the buggy version to be able to backport the fixes.
--- tools/lib/traceevent/plugin_kvm.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
tools/lib/traceevent/plugin_kvm.c +41 -0
@@ -326,6 +326,35 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,return 0 ; } + +static int kvm_nested_vmexit_inject_handler (struct trace_seq *s,struct pevent_record *record, +struct event_format *event,void *context) +{ +unsigned long long val; + +pevent_print_num_field (s," rip %0x016llx" , event,"rip" , record,1 ); + +if (pevent_get_field_val (s, event,"exit_code" , record, &val,1 ) <0 ) +return -1 ; + +trace_seq_printf (s,"reason %s" ,find_exit_reason (2 , val)); + +pevent_print_num_field (s," ext_inf1: %0x016llx" , event,"exit_info1" , record,1 ); +pevent_print_num_field (s," ext_inf2: %0x016llx" , event,"exit_info2" , record,1 ); +pevent_print_num_field (s," ext_int: %0x016llx" , event,"exit_int_info" , record,1 ); +pevent_print_num_field (s," ext_int_err: %0x016llx" , event,"exit_int_info_err" , record,1 ); + +return 0 ; +} + +static int kvm_nested_vmexit_handler (struct trace_seq *s,struct pevent_record *record, +struct event_format *event,void *context) +{ +pevent_print_num_field (s," rip %0x016llx" , event,"rip" , record,1 ); + +return kvm_nested_vmexit_inject_handler (s, record, event, context); +} + union kvm_mmu_page_role { unsigned word; struct {
@@ -422,6 +451,12 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)pevent_register_event_handler (pevent,-1 ,"kvm" ,"kvm_emulate_insn" , kvm_emulate_insn_handler,NULL ); +pevent_register_event_handler (pevent,-1 ,"kvm" ,"kvm_nested_vmexit" , + kvm_nested_vmexit_handler,NULL ); + +pevent_register_event_handler (pevent,-1 ,"kvm" ,"kvm_nested_vmexit_inject" , + kvm_nested_vmexit_inject_handler,NULL ); +pevent_register_event_handler (pevent,-1 ,"kvmmmu" ,"kvm_mmu_get_page" , kvm_mmu_get_page_handler,NULL );
@@ -456,6 +491,12 @@ void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)pevent_unregister_event_handler (pevent,-1 ,"kvm" ,"kvm_emulate_insn" , kvm_emulate_insn_handler,NULL ); +pevent_unregister_event_handler (pevent,-1 ,"kvm" ,"kvm_nested_vmexit" , + kvm_nested_vmexit_handler,NULL ); + +pevent_unregister_event_handler (pevent,-1 ,"kvm" ,"kvm_nested_vmexit_inject" , + kvm_nested_vmexit_inject_handler,NULL ); +pevent_unregister_event_handler (pevent,-1 ,"kvmmmu" ,"kvm_mmu_get_page" , kvm_mmu_get_page_handler,NULL );
Signature · 1 line
1.8.3.1
PATCH 4/7 tools lib traceevent: Fix and cleanup kvm_nested_vmexit tracepoints
In reply to Jiri OlsaFrom: Jan Kiszka <[email protected]>
Fix several issues of kvm_nested_vmexit[_inject]: field width aren't supported with pevent_print, rip was printed twice/incorrectly, SVM ISA was hard-coded, we don't use ':' to separate field names.
--- tools/lib/traceevent/plugin_kvm.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
tools/lib/traceevent/plugin_kvm.c +6 -12
@@ -330,19 +330,13 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,static int kvm_nested_vmexit_inject_handler (struct trace_seq *s,struct pevent_record *record,struct event_format *event,void *context) { -unsigned long long val; - -pevent_print_num_field (s," rip %0x016llx" , event,"rip" , record,1 ); - -if (pevent_get_field_val (s, event,"exit_code" , record, &val,1 ) <0 ) +if (print_exit_reason (s, record, event,"exit_code" ) <0 )return -1 ; -trace_seq_printf (s,"reason %s" ,find_exit_reason (2 , val)); - -pevent_print_num_field (s," ext_inf1: %0x016llx" , event,"exit_info1" , record,1 ); -pevent_print_num_field (s," ext_inf2: %0x016llx" , event,"exit_info2" , record,1 ); -pevent_print_num_field (s," ext_int: %0x016llx" , event,"exit_int_info" , record,1 ); -pevent_print_num_field (s," ext_int_err: %0x016llx" , event,"exit_int_info_err" , record,1 ); +pevent_print_num_field (s," info1 %llx" , event,"exit_info1" , record,1 ); +pevent_print_num_field (s," info2 %llx" , event,"exit_info2" , record,1 ); +pevent_print_num_field (s," int_info %llx" , event,"exit_int_info" , record,1 ); +pevent_print_num_field (s," int_info_err %llx" , event,"exit_int_info_err" , record,1 );return 0 ; }
@@ -350,7 +344,7 @@ static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_rstatic int kvm_nested_vmexit_handler (struct trace_seq *s,struct pevent_record *record,struct event_format *event,void *context) { -pevent_print_num_field (s," rip %0x016llx" , event,"rip" , record,1 ); +pevent_print_num_field (s,"rip %lx " , event,"rip" , record,1 );return kvm_nested_vmexit_inject_handler (s, record, event, context); }
Signature · 1 line
1.8.3.1
PATCH 5/7 tools lib traceevent: Fix format in plugin_kvm
In reply to Jiri OlsaFrom: Steven Rostedt <[email protected]>
The format field argument passed to the format
in pevent_print_num_field() will be of type long long. That means that %ll must be used instead of %l.
--- tools/lib/traceevent/plugin_kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/traceevent/plugin_kvm.c +1 -1
@@ -344,7 +344,7 @@ static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_rstatic int kvm_nested_vmexit_handler (struct trace_seq *s,struct pevent_record *record,struct event_format *event,void *context) { -pevent_print_num_field (s,"rip %lx " , event,"rip" , record,1 ); +pevent_print_num_field (s,"rip %llx " , event,"rip" , record,1 );return kvm_nested_vmexit_inject_handler (s, record, event, context); }
Signature · 1 line
1.8.3.1
PATCH 6/7 tools lib traceevent: Clean up format of args in cfg80211 plugin
In reply to Jiri OlsaFrom: Steven Rostedt <[email protected]>
While synchronizing what's in trace-cmd vs what's in perf, I came across a change that was made when entering the cfg80211 plugin into the tools/lib/traceevent directory. The function prototype went from:
static unsigned long long process___le16_to_cpup(struct trace_seq *s,
unsigned long long *args)
to:
static unsigned long long
process___le16_to_cpup(struct trace_seq *s,
unsigned long long *args)
I can understand the line break after the long long, but there's no reason to keep args on a separate line.
--- tools/lib/traceevent/plugin_cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/lib/traceevent/plugin_cfg80211.c +1 -2
@@ -5,8 +5,7 @@#include "event-parse.h" static unsigned long long -process___le16_to_cpup (struct trace_seq *s, -unsigned long long *args) +process___le16_to_cpup (struct trace_seq *s,unsigned long long *args) {uint16_t *val = (uint16_t *) (unsigned long ) args[0 ];return val ? (long long )le16toh (*val) :0 ;
Signature · 1 line
1.8.3.1
PATCH 7/7 tools lib traceevent: Clean up format of args in jbd2 plugin
In reply to Jiri OlsaFrom: Steven Rostedt <[email protected]>
While synchronizing what's in trace-cmd vs what's in perf, I came across a change that was made when entering the jbd2 plugin into the tools/lib/traceevent directory. For example, one of the function prototypes went from:
unsigned long long process_jbd2_dev_to_name(struct trace_seq *s,
unsigned long long *args)
to:
static unsigned long long process_jbd2_dev_to_name(struct trace_seq *s,
unsigned long long *args)
I can understand the line break after the long long, but there's no reason to keep args on a separate line.
--- tools/lib/traceevent/plugin_jbd2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/lib/traceevent/plugin_jbd2.c +2 -4
@@ -30,8 +30,7 @@#define MINOR (dev) ((unsigned int) ((dev) & MINORMASK))static unsigned long long -process_jbd2_dev_to_name (struct trace_seq *s, -unsigned long long *args) +process_jbd2_dev_to_name (struct trace_seq *s,unsigned long long *args) {unsigned int dev = args[0 ];
@@ -40,8 +39,7 @@ process_jbd2_dev_to_name(struct trace_seq *s, }static unsigned long long -process_jiffies_to_msecs (struct trace_seq *s, -unsigned long long *args) +process_jiffies_to_msecs (struct trace_seq *s,unsigned long long *args) {unsigned long long jiffies = args[0 ];
Signature · 1 line
1.8.3.1
Quoted 38 lines · Jiri Olsa
hi Ingo,
please consider pullingthanks,
jirkaThe following changes since commit
4ba96195051be30160af6d5f5f83f9a055ab1f23:Merge tag 'perf-core-for-mingo' of
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perfinto perf/core (2014-06-13 08:19:06 +0200)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.gittags/perf-core-for-mingofor you to fetch changes up to
1545d8aca9ac1cb3f503fb9c29543d539d99c7af:tools lib traceevent: Clean up format of args in jbd2 plugin (2014-06-19 18:18:37 +0200)
----------------------------------------------------------------
perf/core improvements and fixes:. Updates from trace-cmd for traceevent
plugin_kvmplus args cleanup (Steven Rostedt, Jan Kiszka)Signed-off-by Jiri Olsa <[email protected]>----------------------------------------------------------------
Jan Kiszka (3):
tools lib traceevent: Report unknown VMX exit reasons with code tools lib traceevent: Factor outprint_exit_reasonin kvm plugin tools lib traceevent: Fix and cleanupkvm_nested_vmexittracepointsSteven Rostedt (3):
tools lib traceevent: Fix format inplugin_kvm
tools lib traceevent: Clean up format of args in cfg80211 plugin tools lib traceevent: Clean up format of args in jbd2 plugin
Quoted 7 lines
Steven Rostedt (Red Hat) (1):
tools lib traceevent: Add back in kvm pluginsnested_vmexiteventstools/lib/traceevent/plugin_cfg80211.c | 3 +- tools/lib/traceevent/plugin_jbd2.c | 6 ++-- tools/lib/traceevent/plugin_kvm.c | 64 +++++++++++++++++++++++++++++----- 3 files changed, 59 insertions(+), 14 deletions(-)
Pulled, thanks a lot Jiri!
Ingo