aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/lib/traceevent/plugin_cfg80211.c3
-rw-r--r--tools/lib/traceevent/plugin_jbd2.c6
-rw-r--r--tools/lib/traceevent/plugin_kvm.c64
3 files changed, 59 insertions, 14 deletions
diff --git a/tools/lib/traceevent/plugin_cfg80211.c b/tools/lib/traceevent/plugin_cfg80211.c
index c066b25905f8..4592d8438318 100644
--- a/tools/lib/traceevent/plugin_cfg80211.c
+++ b/tools/lib/traceevent/plugin_cfg80211.c
@@ -5,8 +5,7 @@
5#include "event-parse.h" 5#include "event-parse.h"
6 6
7static unsigned long long 7static unsigned long long
8process___le16_to_cpup(struct trace_seq *s, 8process___le16_to_cpup(struct trace_seq *s, unsigned long long *args)
9 unsigned long long *args)
10{ 9{
11 uint16_t *val = (uint16_t *) (unsigned long) args[0]; 10 uint16_t *val = (uint16_t *) (unsigned long) args[0];
12 return val ? (long long) le16toh(*val) : 0; 11 return val ? (long long) le16toh(*val) : 0;
diff --git a/tools/lib/traceevent/plugin_jbd2.c b/tools/lib/traceevent/plugin_jbd2.c
index 0db714c721be..5c23d5bd27ce 100644
--- a/tools/lib/traceevent/plugin_jbd2.c
+++ b/tools/lib/traceevent/plugin_jbd2.c
@@ -30,8 +30,7 @@
30#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) 30#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
31 31
32static unsigned long long 32static unsigned long long
33process_jbd2_dev_to_name(struct trace_seq *s, 33process_jbd2_dev_to_name(struct trace_seq *s, unsigned long long *args)
34 unsigned long long *args)
35{ 34{
36 unsigned int dev = args[0]; 35 unsigned int dev = args[0];
37 36
@@ -40,8 +39,7 @@ process_jbd2_dev_to_name(struct trace_seq *s,
40} 39}
41 40
42static unsigned long long 41static unsigned long long
43process_jiffies_to_msecs(struct trace_seq *s, 42process_jiffies_to_msecs(struct trace_seq *s, unsigned long long *args)
44 unsigned long long *args)
45{ 43{
46 unsigned long long jiffies = args[0]; 44 unsigned long long jiffies = args[0];
47 45
diff --git a/tools/lib/traceevent/plugin_kvm.c b/tools/lib/traceevent/plugin_kvm.c
index 9e0e8c61b43b..88fe83dff7cd 100644
--- a/tools/lib/traceevent/plugin_kvm.c
+++ b/tools/lib/traceevent/plugin_kvm.c
@@ -240,25 +240,38 @@ static const char *find_exit_reason(unsigned isa, int val)
240 for (i = 0; strings[i].val >= 0; i++) 240 for (i = 0; strings[i].val >= 0; i++)
241 if (strings[i].val == val) 241 if (strings[i].val == val)
242 break; 242 break;
243 if (strings[i].str) 243
244 return strings[i].str; 244 return strings[i].str;
245 return "UNKNOWN";
246} 245}
247 246
248static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, 247static int print_exit_reason(struct trace_seq *s, struct pevent_record *record,
249 struct event_format *event, void *context) 248 struct event_format *event, const char *field)
250{ 249{
251 unsigned long long isa; 250 unsigned long long isa;
252 unsigned long long val; 251 unsigned long long val;
253 unsigned long long info1 = 0, info2 = 0; 252 const char *reason;
254 253
255 if (pevent_get_field_val(s, event, "exit_reason", record, &val, 1) < 0) 254 if (pevent_get_field_val(s, event, field, record, &val, 1) < 0)
256 return -1; 255 return -1;
257 256
258 if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0) 257 if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0)
259 isa = 1; 258 isa = 1;
260 259
261 trace_seq_printf(s, "reason %s", find_exit_reason(isa, val)); 260 reason = find_exit_reason(isa, val);
261 if (reason)
262 trace_seq_printf(s, "reason %s", reason);
263 else
264 trace_seq_printf(s, "reason UNKNOWN (%llu)", val);
265 return 0;
266}
267
268static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
269 struct event_format *event, void *context)
270{
271 unsigned long long info1 = 0, info2 = 0;
272
273 if (print_exit_reason(s, record, event, "exit_reason") < 0)
274 return -1;
262 275
263 pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); 276 pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1);
264 277
@@ -313,6 +326,29 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,
313 return 0; 326 return 0;
314} 327}
315 328
329
330static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_record *record,
331 struct event_format *event, void *context)
332{
333 if (print_exit_reason(s, record, event, "exit_code") < 0)
334 return -1;
335
336 pevent_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1);
337 pevent_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1);
338 pevent_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1);
339 pevent_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1);
340
341 return 0;
342}
343
344static int kvm_nested_vmexit_handler(struct trace_seq *s, struct pevent_record *record,
345 struct event_format *event, void *context)
346{
347 pevent_print_num_field(s, "rip %llx ", event, "rip", record, 1);
348
349 return kvm_nested_vmexit_inject_handler(s, record, event, context);
350}
351
316union kvm_mmu_page_role { 352union kvm_mmu_page_role {
317 unsigned word; 353 unsigned word;
318 struct { 354 struct {
@@ -409,6 +445,12 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
409 pevent_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", 445 pevent_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
410 kvm_emulate_insn_handler, NULL); 446 kvm_emulate_insn_handler, NULL);
411 447
448 pevent_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit",
449 kvm_nested_vmexit_handler, NULL);
450
451 pevent_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject",
452 kvm_nested_vmexit_inject_handler, NULL);
453
412 pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", 454 pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
413 kvm_mmu_get_page_handler, NULL); 455 kvm_mmu_get_page_handler, NULL);
414 456
@@ -443,6 +485,12 @@ void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
443 pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", 485 pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
444 kvm_emulate_insn_handler, NULL); 486 kvm_emulate_insn_handler, NULL);
445 487
488 pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit",
489 kvm_nested_vmexit_handler, NULL);
490
491 pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject",
492 kvm_nested_vmexit_inject_handler, NULL);
493
446 pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", 494 pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
447 kvm_mmu_get_page_handler, NULL); 495 kvm_mmu_get_page_handler, NULL);
448 496