aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/define_trace.h25
-rw-r--r--include/trace/events/kvm.h121
-rw-r--r--include/trace/events/power.h98
-rw-r--r--include/trace/events/regulator.h141
-rw-r--r--include/trace/events/skb.h4
-rw-r--r--include/trace/events/syscalls.h4
-rw-r--r--include/trace/ftrace.h21
7 files changed, 398 insertions, 16 deletions
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 1dfab5401511..da39b22636f7 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -21,11 +21,30 @@
21#undef CREATE_TRACE_POINTS 21#undef CREATE_TRACE_POINTS
22 22
23#include <linux/stringify.h> 23#include <linux/stringify.h>
24/*
25 * module.h includes tracepoints, and because ftrace.h
26 * pulls in module.h:
27 * trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
28 * linux/ftrace.h -> linux/module.h
29 * we must include module.h here before we play with any of
30 * the TRACE_EVENT() macros, otherwise the tracepoints included
31 * by module.h may break the build.
32 */
33#include <linux/module.h>
24 34
25#undef TRACE_EVENT 35#undef TRACE_EVENT
26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ 36#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
27 DEFINE_TRACE(name) 37 DEFINE_TRACE(name)
28 38
39#undef TRACE_EVENT_CONDITION
40#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
41 TRACE_EVENT(name, \
42 PARAMS(proto), \
43 PARAMS(args), \
44 PARAMS(tstruct), \
45 PARAMS(assign), \
46 PARAMS(print))
47
29#undef TRACE_EVENT_FN 48#undef TRACE_EVENT_FN
30#define TRACE_EVENT_FN(name, proto, args, tstruct, \ 49#define TRACE_EVENT_FN(name, proto, args, tstruct, \
31 assign, print, reg, unreg) \ 50 assign, print, reg, unreg) \
@@ -39,6 +58,10 @@
39#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 58#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
40 DEFINE_TRACE(name) 59 DEFINE_TRACE(name)
41 60
61#undef DEFINE_EVENT_CONDITION
62#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
63 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
64
42#undef DECLARE_TRACE 65#undef DECLARE_TRACE
43#define DECLARE_TRACE(name, proto, args) \ 66#define DECLARE_TRACE(name, proto, args) \
44 DEFINE_TRACE(name) 67 DEFINE_TRACE(name)
@@ -75,9 +98,11 @@
75 98
76#undef TRACE_EVENT 99#undef TRACE_EVENT
77#undef TRACE_EVENT_FN 100#undef TRACE_EVENT_FN
101#undef TRACE_EVENT_CONDITION
78#undef DECLARE_EVENT_CLASS 102#undef DECLARE_EVENT_CLASS
79#undef DEFINE_EVENT 103#undef DEFINE_EVENT
80#undef DEFINE_EVENT_PRINT 104#undef DEFINE_EVENT_PRINT
105#undef DEFINE_EVENT_CONDITION
81#undef TRACE_HEADER_MULTI_READ 106#undef TRACE_HEADER_MULTI_READ
82#undef DECLARE_TRACE 107#undef DECLARE_TRACE
83 108
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 6dd3a51ab1cb..46e3cd8e197a 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -6,6 +6,36 @@
6#undef TRACE_SYSTEM 6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm 7#define TRACE_SYSTEM kvm
8 8
9#define ERSN(x) { KVM_EXIT_##x, "KVM_EXIT_" #x }
10
11#define kvm_trace_exit_reason \
12 ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL), \
13 ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN), \
14 ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR), \
15 ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
16 ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI)
17
18TRACE_EVENT(kvm_userspace_exit,
19 TP_PROTO(__u32 reason, int errno),
20 TP_ARGS(reason, errno),
21
22 TP_STRUCT__entry(
23 __field( __u32, reason )
24 __field( int, errno )
25 ),
26
27 TP_fast_assign(
28 __entry->reason = reason;
29 __entry->errno = errno;
30 ),
31
32 TP_printk("reason %s (%d)",
33 __entry->errno < 0 ?
34 (__entry->errno == -EINTR ? "restart" : "error") :
35 __print_symbolic(__entry->reason, kvm_trace_exit_reason),
36 __entry->errno < 0 ? -__entry->errno : __entry->reason)
37);
38
9#if defined(__KVM_HAVE_IOAPIC) 39#if defined(__KVM_HAVE_IOAPIC)
10TRACE_EVENT(kvm_set_irq, 40TRACE_EVENT(kvm_set_irq,
11 TP_PROTO(unsigned int gsi, int level, int irq_source_id), 41 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
@@ -185,6 +215,97 @@ TRACE_EVENT(kvm_age_page,
185 __entry->referenced ? "YOUNG" : "OLD") 215 __entry->referenced ? "YOUNG" : "OLD")
186); 216);
187 217
218#ifdef CONFIG_KVM_ASYNC_PF
219DECLARE_EVENT_CLASS(kvm_async_get_page_class,
220
221 TP_PROTO(u64 gva, u64 gfn),
222
223 TP_ARGS(gva, gfn),
224
225 TP_STRUCT__entry(
226 __field(__u64, gva)
227 __field(u64, gfn)
228 ),
229
230 TP_fast_assign(
231 __entry->gva = gva;
232 __entry->gfn = gfn;
233 ),
234
235 TP_printk("gva = %#llx, gfn = %#llx", __entry->gva, __entry->gfn)
236);
237
238DEFINE_EVENT(kvm_async_get_page_class, kvm_try_async_get_page,
239
240 TP_PROTO(u64 gva, u64 gfn),
241
242 TP_ARGS(gva, gfn)
243);
244
245DEFINE_EVENT(kvm_async_get_page_class, kvm_async_pf_doublefault,
246
247 TP_PROTO(u64 gva, u64 gfn),
248
249 TP_ARGS(gva, gfn)
250);
251
252DECLARE_EVENT_CLASS(kvm_async_pf_nopresent_ready,
253
254 TP_PROTO(u64 token, u64 gva),
255
256 TP_ARGS(token, gva),
257
258 TP_STRUCT__entry(
259 __field(__u64, token)
260 __field(__u64, gva)
261 ),
262
263 TP_fast_assign(
264 __entry->token = token;
265 __entry->gva = gva;
266 ),
267
268 TP_printk("token %#llx gva %#llx", __entry->token, __entry->gva)
269
270);
271
272DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_not_present,
273
274 TP_PROTO(u64 token, u64 gva),
275
276 TP_ARGS(token, gva)
277);
278
279DEFINE_EVENT(kvm_async_pf_nopresent_ready, kvm_async_pf_ready,
280
281 TP_PROTO(u64 token, u64 gva),
282
283 TP_ARGS(token, gva)
284);
285
286TRACE_EVENT(
287 kvm_async_pf_completed,
288 TP_PROTO(unsigned long address, struct page *page, u64 gva),
289 TP_ARGS(address, page, gva),
290
291 TP_STRUCT__entry(
292 __field(unsigned long, address)
293 __field(pfn_t, pfn)
294 __field(u64, gva)
295 ),
296
297 TP_fast_assign(
298 __entry->address = address;
299 __entry->pfn = page ? page_to_pfn(page) : 0;
300 __entry->gva = gva;
301 ),
302
303 TP_printk("gva %#llx address %#lx pfn %#llx", __entry->gva,
304 __entry->address, __entry->pfn)
305);
306
307#endif
308
188#endif /* _TRACE_KVM_MAIN_H */ 309#endif /* _TRACE_KVM_MAIN_H */
189 310
190/* This part must be outside protection */ 311/* This part must be outside protection */
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 286784d69b8f..1bcc2a8c00e2 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -7,16 +7,67 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10#ifndef _TRACE_POWER_ENUM_ 10DECLARE_EVENT_CLASS(cpu,
11#define _TRACE_POWER_ENUM_ 11
12enum { 12 TP_PROTO(unsigned int state, unsigned int cpu_id),
13 POWER_NONE = 0, 13
14 POWER_CSTATE = 1, /* C-State */ 14 TP_ARGS(state, cpu_id),
15 POWER_PSTATE = 2, /* Fequency change or DVFS */ 15
16 POWER_SSTATE = 3, /* Suspend */ 16 TP_STRUCT__entry(
17}; 17 __field( u32, state )
18 __field( u32, cpu_id )
19 ),
20
21 TP_fast_assign(
22 __entry->state = state;
23 __entry->cpu_id = cpu_id;
24 ),
25
26 TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
27 (unsigned long)__entry->cpu_id)
28);
29
30DEFINE_EVENT(cpu, cpu_idle,
31
32 TP_PROTO(unsigned int state, unsigned int cpu_id),
33
34 TP_ARGS(state, cpu_id)
35);
36
37/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
38#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
39#define _PWR_EVENT_AVOID_DOUBLE_DEFINING
40
41#define PWR_EVENT_EXIT -1
18#endif 42#endif
19 43
44DEFINE_EVENT(cpu, cpu_frequency,
45
46 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
47
48 TP_ARGS(frequency, cpu_id)
49);
50
51TRACE_EVENT(machine_suspend,
52
53 TP_PROTO(unsigned int state),
54
55 TP_ARGS(state),
56
57 TP_STRUCT__entry(
58 __field( u32, state )
59 ),
60
61 TP_fast_assign(
62 __entry->state = state;
63 ),
64
65 TP_printk("state=%lu", (unsigned long)__entry->state)
66);
67
68/* This code will be removed after deprecation time exceeded (2.6.41) */
69#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
70
20/* 71/*
21 * The power events are used for cpuidle & suspend (power_start, power_end) 72 * The power events are used for cpuidle & suspend (power_start, power_end)
22 * and for cpufreq (power_frequency) 73 * and for cpufreq (power_frequency)
@@ -75,6 +126,36 @@ TRACE_EVENT(power_end,
75 126
76); 127);
77 128
129/* Deprecated dummy functions must be protected against multi-declartion */
130#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
131#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
132
133enum {
134 POWER_NONE = 0,
135 POWER_CSTATE = 1,
136 POWER_PSTATE = 2,
137};
138#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
139
140#else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
141
142#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
143#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
144enum {
145 POWER_NONE = 0,
146 POWER_CSTATE = 1,
147 POWER_PSTATE = 2,
148};
149
150/* These dummy declaration have to be ripped out when the deprecated
151 events get removed */
152static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
153static inline void trace_power_end(u64 cpuid) {};
154static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
155#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
156
157#endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
158
78/* 159/*
79 * The clock events are used for clock enable/disable and for 160 * The clock events are used for clock enable/disable and for
80 * clock rate change 161 * clock rate change
@@ -153,7 +234,6 @@ DEFINE_EVENT(power_domain, power_domain_target,
153 234
154 TP_ARGS(name, state, cpu_id) 235 TP_ARGS(name, state, cpu_id)
155); 236);
156
157#endif /* _TRACE_POWER_H */ 237#endif /* _TRACE_POWER_H */
158 238
159/* This part must be outside protection */ 239/* This part must be outside protection */
diff --git a/include/trace/events/regulator.h b/include/trace/events/regulator.h
new file mode 100644
index 000000000000..37502a7404b7
--- /dev/null
+++ b/include/trace/events/regulator.h
@@ -0,0 +1,141 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM regulator
3
4#if !defined(_TRACE_REGULATOR_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_REGULATOR_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10/*
11 * Events which just log themselves and the regulator name for enable/disable
12 * type tracking.
13 */
14DECLARE_EVENT_CLASS(regulator_basic,
15
16 TP_PROTO(const char *name),
17
18 TP_ARGS(name),
19
20 TP_STRUCT__entry(
21 __string( name, name )
22 ),
23
24 TP_fast_assign(
25 __assign_str(name, name);
26 ),
27
28 TP_printk("name=%s", __get_str(name))
29
30);
31
32DEFINE_EVENT(regulator_basic, regulator_enable,
33
34 TP_PROTO(const char *name),
35
36 TP_ARGS(name)
37
38);
39
40DEFINE_EVENT(regulator_basic, regulator_enable_delay,
41
42 TP_PROTO(const char *name),
43
44 TP_ARGS(name)
45
46);
47
48DEFINE_EVENT(regulator_basic, regulator_enable_complete,
49
50 TP_PROTO(const char *name),
51
52 TP_ARGS(name)
53
54);
55
56DEFINE_EVENT(regulator_basic, regulator_disable,
57
58 TP_PROTO(const char *name),
59
60 TP_ARGS(name)
61
62);
63
64DEFINE_EVENT(regulator_basic, regulator_disable_complete,
65
66 TP_PROTO(const char *name),
67
68 TP_ARGS(name)
69
70);
71
72/*
73 * Events that take a range of numerical values, mostly for voltages
74 * and so on.
75 */
76DECLARE_EVENT_CLASS(regulator_range,
77
78 TP_PROTO(const char *name, int min, int max),
79
80 TP_ARGS(name, min, max),
81
82 TP_STRUCT__entry(
83 __string( name, name )
84 __field( int, min )
85 __field( int, max )
86 ),
87
88 TP_fast_assign(
89 __assign_str(name, name);
90 __entry->min = min;
91 __entry->max = max;
92 ),
93
94 TP_printk("name=%s (%d-%d)", __get_str(name),
95 (int)__entry->min, (int)__entry->max)
96);
97
98DEFINE_EVENT(regulator_range, regulator_set_voltage,
99
100 TP_PROTO(const char *name, int min, int max),
101
102 TP_ARGS(name, min, max)
103
104);
105
106
107/*
108 * Events that take a single value, mostly for readback and refcounts.
109 */
110DECLARE_EVENT_CLASS(regulator_value,
111
112 TP_PROTO(const char *name, unsigned int val),
113
114 TP_ARGS(name, val),
115
116 TP_STRUCT__entry(
117 __string( name, name )
118 __field( unsigned int, val )
119 ),
120
121 TP_fast_assign(
122 __assign_str(name, name);
123 __entry->val = val;
124 ),
125
126 TP_printk("name=%s, val=%u", __get_str(name),
127 (int)__entry->val)
128);
129
130DEFINE_EVENT(regulator_value, regulator_set_voltage_complete,
131
132 TP_PROTO(const char *name, unsigned int value),
133
134 TP_ARGS(name, value)
135
136);
137
138#endif /* _TRACE_POWER_H */
139
140/* This part must be outside protection */
141#include <trace/define_trace.h>
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 75ce9d500d8e..f10293c41b1e 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,
25 25
26 TP_fast_assign( 26 TP_fast_assign(
27 __entry->skbaddr = skb; 27 __entry->skbaddr = skb;
28 if (skb) { 28 __entry->protocol = ntohs(skb->protocol);
29 __entry->protocol = ntohs(skb->protocol);
30 }
31 __entry->location = location; 29 __entry->location = location;
32 ), 30 ),
33 31
diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
index fb726ac7caee..5a4c04a75b3d 100644
--- a/include/trace/events/syscalls.h
+++ b/include/trace/events/syscalls.h
@@ -40,6 +40,8 @@ TRACE_EVENT_FN(sys_enter,
40 syscall_regfunc, syscall_unregfunc 40 syscall_regfunc, syscall_unregfunc
41); 41);
42 42
43TRACE_EVENT_FLAGS(sys_enter, TRACE_EVENT_FL_CAP_ANY)
44
43TRACE_EVENT_FN(sys_exit, 45TRACE_EVENT_FN(sys_exit,
44 46
45 TP_PROTO(struct pt_regs *regs, long ret), 47 TP_PROTO(struct pt_regs *regs, long ret),
@@ -62,6 +64,8 @@ TRACE_EVENT_FN(sys_exit,
62 syscall_regfunc, syscall_unregfunc 64 syscall_regfunc, syscall_unregfunc
63); 65);
64 66
67TRACE_EVENT_FLAGS(sys_exit, TRACE_EVENT_FL_CAP_ANY)
68
65#endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ 69#endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
66 70
67#endif /* _TRACE_EVENTS_SYSCALLS_H */ 71#endif /* _TRACE_EVENTS_SYSCALLS_H */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index a9377c0083ad..e16610c208c9 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -82,6 +82,10 @@
82 TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \ 82 TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
83 PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \ 83 PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \
84 84
85#undef TRACE_EVENT_FLAGS
86#define TRACE_EVENT_FLAGS(name, value) \
87 __TRACE_EVENT_FLAGS(name, value)
88
85#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 89#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
86 90
87 91
@@ -129,6 +133,9 @@
129#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 133#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
130 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) 134 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
131 135
136#undef TRACE_EVENT_FLAGS
137#define TRACE_EVENT_FLAGS(event, flag)
138
132#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 139#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
133 140
134/* 141/*
@@ -289,13 +296,19 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
289 296
290#undef __array 297#undef __array
291#define __array(type, item, len) \ 298#define __array(type, item, len) \
292 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 299 do { \
293 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 300 mutex_lock(&event_storage_mutex); \
301 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
302 snprintf(event_storage, sizeof(event_storage), \
303 "%s[%d]", #type, len); \
304 ret = trace_define_field(event_call, event_storage, #item, \
294 offsetof(typeof(field), item), \ 305 offsetof(typeof(field), item), \
295 sizeof(field.item), \ 306 sizeof(field.item), \
296 is_signed_type(type), FILTER_OTHER); \ 307 is_signed_type(type), FILTER_OTHER); \
297 if (ret) \ 308 mutex_unlock(&event_storage_mutex); \
298 return ret; 309 if (ret) \
310 return ret; \
311 } while (0);
299 312
300#undef __dynamic_array 313#undef __dynamic_array
301#define __dynamic_array(type, item, len) \ 314#define __dynamic_array(type, item, len) \