1 // SPDX-License-Identifier: LGPL-2.1
9 #include "event-parse.h"
11 enum tlb_flush_reason {
12 TLB_FLUSH_ON_TASK_SWITCH,
15 TLB_LOCAL_MM_SHOOTDOWN,
19 static int tlb_flush_handler(struct trace_seq *s, struct tep_record *record,
20 struct tep_event *event, void *context)
22 unsigned long long val;
24 trace_seq_printf(s, "pages=");
26 tep_print_num_field(s, "%ld", event, "pages", record, 1);
28 if (tep_get_field_val(s, event, "reason", record, &val, 1) < 0)
31 trace_seq_puts(s, " reason=");
34 case TLB_FLUSH_ON_TASK_SWITCH:
35 trace_seq_puts(s, "flush on task switch");
37 case TLB_REMOTE_SHOOTDOWN:
38 trace_seq_puts(s, "remote shootdown");
40 case TLB_LOCAL_SHOOTDOWN:
41 trace_seq_puts(s, "local shootdown");
43 case TLB_LOCAL_MM_SHOOTDOWN:
44 trace_seq_puts(s, "local mm shootdown");
48 trace_seq_printf(s, " (%lld)", val);
53 int TEP_PLUGIN_LOADER(struct tep_handle *tep)
55 tep_register_event_handler(tep, -1, "tlb", "tlb_flush",
56 tlb_flush_handler, NULL);
61 void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
63 tep_unregister_event_handler(tep, -1,
65 tlb_flush_handler, NULL);