Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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>
  • Loading branch information
Ingo Molnar committed Jun 25, 2014
2 parents 06c654c + 1545d8a commit 1c92f88
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 14 deletions.
3 changes: 1 addition & 2 deletions tools/lib/traceevent/plugin_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions tools/lib/traceevent/plugin_jbd2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

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

Expand Down
64 changes: 56 additions & 8 deletions tools/lib/traceevent/plugin_kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 1c92f88

Please sign in to comment.