blob: c13c6fa3fa92c33f78d7127cfcb83b5822b9778b [file] [log] [blame]
Dave Hansene7126cf2015-06-07 11:37:03 -07001#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
Dave Hansen97efebf2015-06-07 11:37:03 -070011TRACE_EVENT(mpx_bounds_register_exception,
12
13 TP_PROTO(void *addr_referenced,
14 const struct 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
Dave Hansene7126cf2015-06-07 11:37:03 -070045TRACE_EVENT(bounds_exception_mpx,
46
47 TP_PROTO(const struct 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
Dave Hansen2a1dcb12015-06-07 11:37:03 -070066DECLARE_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
88DEFINE_EVENT(mpx_range_trace, mpx_unmap_zap,
89 TP_PROTO(unsigned long start, unsigned long end),
90 TP_ARGS(start, end)
91);
92
93DEFINE_EVENT(mpx_range_trace, mpx_unmap_search,
94 TP_PROTO(unsigned long start, unsigned long end),
95 TP_ARGS(start, end)
96);
97
Dave Hansene7126cf2015-06-07 11:37:03 -070098#else
99
100/*
101 * This gets used outside of MPX-specific code, so we need a stub.
102 */
103static inline void trace_bounds_exception_mpx(const struct bndcsr *bndcsr)
104{
105}
106
107#endif /* CONFIG_X86_INTEL_MPX */
108
109#undef TRACE_INCLUDE_PATH
110#define TRACE_INCLUDE_PATH asm/trace/
111#undef TRACE_INCLUDE_FILE
112#define TRACE_INCLUDE_FILE mpx
113#endif /* _TRACE_MPX_H */
114
115/* This part must be outside protection */
116#include <trace/define_trace.h>