• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM mpx
3 
4 #if !defined(_TRACE_MPX_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_MPX_H
6 
7 #include <linux/tracepoint.h>
8 
9 #ifdef CONFIG_X86_INTEL_MPX
10 
11 TRACE_EVENT(mpx_bounds_register_exception,
12 
13 	TP_PROTO(void *addr_referenced,
14 		 const struct mpx_bndreg *bndreg),
15 	TP_ARGS(addr_referenced, bndreg),
16 
17 	TP_STRUCT__entry(
18 		__field(void *, addr_referenced)
19 		__field(u64, lower_bound)
20 		__field(u64, upper_bound)
21 	),
22 
23 	TP_fast_assign(
24 		__entry->addr_referenced = addr_referenced;
25 		__entry->lower_bound = bndreg->lower_bound;
26 		__entry->upper_bound = bndreg->upper_bound;
27 	),
28 	/*
29 	 * Note that we are printing out the '~' of the upper
30 	 * bounds register here.  It is actually stored in its
31 	 * one's complement form so that its 'init' state
32 	 * corresponds to all 0's.  But, that looks like
33 	 * gibberish when printed out, so print out the 1's
34 	 * complement instead of the actual value here.  Note
35 	 * though that you still need to specify filters for the
36 	 * actual value, not the displayed one.
37 	 */
38 	TP_printk("address referenced: 0x%p bounds: lower: 0x%llx ~upper: 0x%llx",
39 		__entry->addr_referenced,
40 		__entry->lower_bound,
41 		~__entry->upper_bound
42 	)
43 );
44 
45 TRACE_EVENT(bounds_exception_mpx,
46 
47 	TP_PROTO(const struct mpx_bndcsr *bndcsr),
48 	TP_ARGS(bndcsr),
49 
50 	TP_STRUCT__entry(
51 		__field(u64, bndcfgu)
52 		__field(u64, bndstatus)
53 	),
54 
55 	TP_fast_assign(
56 		/* need to get rid of the 'const' on bndcsr */
57 		__entry->bndcfgu   = (u64)bndcsr->bndcfgu;
58 		__entry->bndstatus = (u64)bndcsr->bndstatus;
59 	),
60 
61 	TP_printk("bndcfgu:0x%llx bndstatus:0x%llx",
62 		__entry->bndcfgu,
63 		__entry->bndstatus)
64 );
65 
66 DECLARE_EVENT_CLASS(mpx_range_trace,
67 
68 	TP_PROTO(unsigned long start,
69 		 unsigned long end),
70 	TP_ARGS(start, end),
71 
72 	TP_STRUCT__entry(
73 		__field(unsigned long, start)
74 		__field(unsigned long, end)
75 	),
76 
77 	TP_fast_assign(
78 		__entry->start = start;
79 		__entry->end   = end;
80 	),
81 
82 	TP_printk("[0x%p:0x%p]",
83 		(void *)__entry->start,
84 		(void *)__entry->end
85 	)
86 );
87 
88 DEFINE_EVENT(mpx_range_trace, mpx_unmap_zap,
89 	TP_PROTO(unsigned long start, unsigned long end),
90 	TP_ARGS(start, end)
91 );
92 
93 DEFINE_EVENT(mpx_range_trace, mpx_unmap_search,
94 	TP_PROTO(unsigned long start, unsigned long end),
95 	TP_ARGS(start, end)
96 );
97 
98 TRACE_EVENT(mpx_new_bounds_table,
99 
100 	TP_PROTO(unsigned long table_vaddr),
101 	TP_ARGS(table_vaddr),
102 
103 	TP_STRUCT__entry(
104 		__field(unsigned long, table_vaddr)
105 	),
106 
107 	TP_fast_assign(
108 		__entry->table_vaddr = table_vaddr;
109 	),
110 
111 	TP_printk("table vaddr:%p", (void *)__entry->table_vaddr)
112 );
113 
114 #else
115 
116 /*
117  * This gets used outside of MPX-specific code, so we need a stub.
118  */
119 static inline
trace_bounds_exception_mpx(const struct mpx_bndcsr * bndcsr)120 void trace_bounds_exception_mpx(const struct mpx_bndcsr *bndcsr)
121 {
122 }
123 
124 #endif /* CONFIG_X86_INTEL_MPX */
125 
126 #undef TRACE_INCLUDE_PATH
127 #define TRACE_INCLUDE_PATH asm/trace/
128 #undef TRACE_INCLUDE_FILE
129 #define TRACE_INCLUDE_FILE mpx
130 #endif /* _TRACE_MPX_H */
131 
132 /* This part must be outside protection */
133 #include <trace/define_trace.h>
134