diff options
-rw-r--r-- | include/linux/tracepoint.h | 29 | ||||
-rw-r--r-- | include/trace/define_trace.h | 15 |
2 files changed, 38 insertions, 6 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 5a6074fcd81d..d3e4f87e95c0 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -106,6 +106,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, | |||
106 | 106 | ||
107 | #define TP_PROTO(args...) args | 107 | #define TP_PROTO(args...) args |
108 | #define TP_ARGS(args...) args | 108 | #define TP_ARGS(args...) args |
109 | #define TP_CONDITION(args...) args | ||
109 | 110 | ||
110 | #ifdef CONFIG_TRACEPOINTS | 111 | #ifdef CONFIG_TRACEPOINTS |
111 | 112 | ||
@@ -119,12 +120,14 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, | |||
119 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just | 120 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just |
120 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". | 121 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". |
121 | */ | 122 | */ |
122 | #define __DO_TRACE(tp, proto, args) \ | 123 | #define __DO_TRACE(tp, proto, args, cond) \ |
123 | do { \ | 124 | do { \ |
124 | struct tracepoint_func *it_func_ptr; \ | 125 | struct tracepoint_func *it_func_ptr; \ |
125 | void *it_func; \ | 126 | void *it_func; \ |
126 | void *__data; \ | 127 | void *__data; \ |
127 | \ | 128 | \ |
129 | if (!(cond)) \ | ||
130 | return; \ | ||
128 | rcu_read_lock_sched_notrace(); \ | 131 | rcu_read_lock_sched_notrace(); \ |
129 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ | 132 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ |
130 | if (it_func_ptr) { \ | 133 | if (it_func_ptr) { \ |
@@ -142,7 +145,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, | |||
142 | * not add unwanted padding between the beginning of the section and the | 145 | * not add unwanted padding between the beginning of the section and the |
143 | * structure. Force alignment to the same alignment as the section start. | 146 | * structure. Force alignment to the same alignment as the section start. |
144 | */ | 147 | */ |
145 | #define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ | 148 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
146 | extern struct tracepoint __tracepoint_##name; \ | 149 | extern struct tracepoint __tracepoint_##name; \ |
147 | static inline void trace_##name(proto) \ | 150 | static inline void trace_##name(proto) \ |
148 | { \ | 151 | { \ |
@@ -151,7 +154,8 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, | |||
151 | do_trace: \ | 154 | do_trace: \ |
152 | __DO_TRACE(&__tracepoint_##name, \ | 155 | __DO_TRACE(&__tracepoint_##name, \ |
153 | TP_PROTO(data_proto), \ | 156 | TP_PROTO(data_proto), \ |
154 | TP_ARGS(data_args)); \ | 157 | TP_ARGS(data_args), \ |
158 | TP_CONDITION(cond)); \ | ||
155 | } \ | 159 | } \ |
156 | static inline int \ | 160 | static inline int \ |
157 | register_trace_##name(void (*probe)(data_proto), void *data) \ | 161 | register_trace_##name(void (*probe)(data_proto), void *data) \ |
@@ -186,7 +190,7 @@ do_trace: \ | |||
186 | EXPORT_SYMBOL(__tracepoint_##name) | 190 | EXPORT_SYMBOL(__tracepoint_##name) |
187 | 191 | ||
188 | #else /* !CONFIG_TRACEPOINTS */ | 192 | #else /* !CONFIG_TRACEPOINTS */ |
189 | #define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ | 193 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
190 | static inline void trace_##name(proto) \ | 194 | static inline void trace_##name(proto) \ |
191 | { } \ | 195 | { } \ |
192 | static inline int \ | 196 | static inline int \ |
@@ -227,13 +231,18 @@ do_trace: \ | |||
227 | * "void *__data, proto" as the callback prototype. | 231 | * "void *__data, proto" as the callback prototype. |
228 | */ | 232 | */ |
229 | #define DECLARE_TRACE_NOARGS(name) \ | 233 | #define DECLARE_TRACE_NOARGS(name) \ |
230 | __DECLARE_TRACE(name, void, , void *__data, __data) | 234 | __DECLARE_TRACE(name, void, , 1, void *__data, __data) |
231 | 235 | ||
232 | #define DECLARE_TRACE(name, proto, args) \ | 236 | #define DECLARE_TRACE(name, proto, args) \ |
233 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ | 237 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \ |
234 | PARAMS(void *__data, proto), \ | 238 | PARAMS(void *__data, proto), \ |
235 | PARAMS(__data, args)) | 239 | PARAMS(__data, args)) |
236 | 240 | ||
241 | #define DECLARE_TRACE_CONDITION(name, proto, args, cond) \ | ||
242 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \ | ||
243 | PARAMS(void *__data, proto), \ | ||
244 | PARAMS(__data, args)) | ||
245 | |||
237 | #define TRACE_EVENT_FLAGS(event, flag) | 246 | #define TRACE_EVENT_FLAGS(event, flag) |
238 | 247 | ||
239 | #endif /* DECLARE_TRACE */ | 248 | #endif /* DECLARE_TRACE */ |
@@ -349,12 +358,20 @@ do_trace: \ | |||
349 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 358 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
350 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 359 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
351 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 360 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
361 | #define DEFINE_EVENT_CONDITION(template, name, proto, \ | ||
362 | args, cond) \ | ||
363 | DECLARE_TRACE_CONDITION(name, PARAMS(proto), \ | ||
364 | PARAMS(args), PARAMS(cond)) | ||
352 | 365 | ||
353 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | 366 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ |
354 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 367 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
355 | #define TRACE_EVENT_FN(name, proto, args, struct, \ | 368 | #define TRACE_EVENT_FN(name, proto, args, struct, \ |
356 | assign, print, reg, unreg) \ | 369 | assign, print, reg, unreg) \ |
357 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 370 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
371 | #define TRACE_EVENT_CONDITION(name, proto, args, cond, \ | ||
372 | struct, assign, print) \ | ||
373 | DECLARE_TRACE_CONDITION(name, PARAMS(proto), \ | ||
374 | PARAMS(args), PARAMS(cond)) | ||
358 | 375 | ||
359 | #define TRACE_EVENT_FLAGS(event, flag) | 376 | #define TRACE_EVENT_FLAGS(event, flag) |
360 | 377 | ||
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 1dfab5401511..b0b4eb24d592 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h | |||
@@ -26,6 +26,15 @@ | |||
26 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ | 26 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ |
27 | DEFINE_TRACE(name) | 27 | DEFINE_TRACE(name) |
28 | 28 | ||
29 | #undef TRACE_EVENT_CONDITION | ||
30 | #define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \ | ||
31 | TRACE_EVENT(name, \ | ||
32 | PARAMS(proto), \ | ||
33 | PARAMS(args), \ | ||
34 | PARAMS(tstruct), \ | ||
35 | PARAMS(assign), \ | ||
36 | PARAMS(print)) | ||
37 | |||
29 | #undef TRACE_EVENT_FN | 38 | #undef TRACE_EVENT_FN |
30 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ | 39 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ |
31 | assign, print, reg, unreg) \ | 40 | assign, print, reg, unreg) \ |
@@ -39,6 +48,10 @@ | |||
39 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 48 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
40 | DEFINE_TRACE(name) | 49 | DEFINE_TRACE(name) |
41 | 50 | ||
51 | #undef DEFINE_EVENT_CONDITION | ||
52 | #define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \ | ||
53 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
54 | |||
42 | #undef DECLARE_TRACE | 55 | #undef DECLARE_TRACE |
43 | #define DECLARE_TRACE(name, proto, args) \ | 56 | #define DECLARE_TRACE(name, proto, args) \ |
44 | DEFINE_TRACE(name) | 57 | DEFINE_TRACE(name) |
@@ -75,9 +88,11 @@ | |||
75 | 88 | ||
76 | #undef TRACE_EVENT | 89 | #undef TRACE_EVENT |
77 | #undef TRACE_EVENT_FN | 90 | #undef TRACE_EVENT_FN |
91 | #undef TRACE_EVENT_CONDITION | ||
78 | #undef DECLARE_EVENT_CLASS | 92 | #undef DECLARE_EVENT_CLASS |
79 | #undef DEFINE_EVENT | 93 | #undef DEFINE_EVENT |
80 | #undef DEFINE_EVENT_PRINT | 94 | #undef DEFINE_EVENT_PRINT |
95 | #undef DEFINE_EVENT_CONDITION | ||
81 | #undef TRACE_HEADER_MULTI_READ | 96 | #undef TRACE_HEADER_MULTI_READ |
82 | #undef DECLARE_TRACE | 97 | #undef DECLARE_TRACE |
83 | 98 | ||