perf/core improvements and fixes:

. Updates from trace-cmd for traceevent plugin_kvm plus args cleanup (Steven Rostedt, Jan Kiszka)
 
 Signed-off-by: Jiri Olsa <jolsa@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTo+cjAAoJEPZqUSBWB3s9FmgQAMGQVxlwaGBdHrczPMwHjPgS
 GDbzzF5Qlk4PfE5gKVgKyHumx/wsNNgDc/t9fRng5TwnAJTnNu0b8mtzAvOCCjGK
 1BXEhFNhBh1NV6yCd/UjXfCg7v8Wg73weDUffiAjrigNqH5pIi2Ug/SiCdL3fxkA
 a5+zpsTwo630UR+GlwWqBUNrXYlEV9dv8+39ydTg2paihyaS65pLEjh6ahIfybd1
 lRY3n0c0SZgJl0GZxqkJxpGlAzp6FdoPFzcyMnK6+VfOR8NX9SakU7mAXCmC5eiu
 qJ8j0vOvcSQruhGXuDD3Lu1rmE98vaoVC2bJJ/bCacVcgRoVkN/J3mxOBDn98aRm
 d52umBTGTFCbvZdFVYxs9WAMyixV6RTiRZKCCdcVSiI2tvSGcfE7KvnGKKR6F3Re
 qnov2NSpca44LSbtvl4OY+fDbOLrD8ZEslgO6qxa+J+AFAiu2hAJbGNG22zYSZT3
 jOwCgx1GPdlcchmCOoXXdrZLZ6qf1YGb1mZXCMRdArABv3ZO01N0PXcRMSmCQVaE
 HinB5awLo95YIEy89EiVQLqsDvI143Fr7j3gsjcgmWpiT5OTewRkyNViCBphol4o
 tSSkgICzr6wd1rFgHmeLlDw3ic0LDw2DfYG/5P0WHdObJLMY83p1Y1J+sHmJ1GtY
 IAPWoDTRejiZ2kL5CC5+
 =S9cK
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core

Pull perf/core improvements and fixes from Jiri Olsa:

  * Updates from trace-cmd for traceevent plugin_kvm plus args cleanup (Steven Rostedt, Jan Kiszka)

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2014-06-25 07:44:19 +02:00
commit 1c92f88542
3 changed files with 59 additions and 14 deletions

View File

@ -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;

View File

@ -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];

View File

@ -240,25 +240,38 @@ 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,
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)
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);
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);
@ -313,6 +326,29 @@ 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)
{
if (print_exit_reason(s, record, event, "exit_code") < 0)
return -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;
}
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 %llx ", event, "rip", record, 1);
return kvm_nested_vmexit_inject_handler(s, record, event, context);
}
union kvm_mmu_page_role {
unsigned word;
struct {
@ -409,6 +445,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);
@ -443,6 +485,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);