diff options
Diffstat (limited to 'include/linux/tracepoint.h')
-rw-r--r-- | include/linux/tracepoint.h | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index a4a90b6726ce..c6814616653b 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -32,7 +32,7 @@ struct tracepoint { | |||
32 | int state; /* State. */ | 32 | int state; /* State. */ |
33 | void (*regfunc)(void); | 33 | void (*regfunc)(void); |
34 | void (*unregfunc)(void); | 34 | void (*unregfunc)(void); |
35 | struct tracepoint_func *funcs; | 35 | struct tracepoint_func __rcu *funcs; |
36 | } __attribute__((aligned(32))); /* | 36 | } __attribute__((aligned(32))); /* |
37 | * Aligned on 32 bytes because it is | 37 | * Aligned on 32 bytes because it is |
38 | * globally visible and gcc happily | 38 | * globally visible and gcc happily |
@@ -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,20 @@ 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 | |||
246 | #define TRACE_EVENT_FLAGS(event, flag) | ||
247 | |||
237 | #endif /* DECLARE_TRACE */ | 248 | #endif /* DECLARE_TRACE */ |
238 | 249 | ||
239 | #ifndef TRACE_EVENT | 250 | #ifndef TRACE_EVENT |
@@ -315,7 +326,7 @@ do_trace: \ | |||
315 | * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); | 326 | * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); |
316 | * __entry->next_pid = next->pid; | 327 | * __entry->next_pid = next->pid; |
317 | * __entry->next_prio = next->prio; | 328 | * __entry->next_prio = next->prio; |
318 | * ) | 329 | * ), |
319 | * | 330 | * |
320 | * * | 331 | * * |
321 | * * Formatted output of a trace record via TP_printk(). | 332 | * * Formatted output of a trace record via TP_printk(). |
@@ -347,11 +358,21 @@ do_trace: \ | |||
347 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 358 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
348 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 359 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
349 | 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)) | ||
350 | 365 | ||
351 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | 366 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ |
352 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 367 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
353 | #define TRACE_EVENT_FN(name, proto, args, struct, \ | 368 | #define TRACE_EVENT_FN(name, proto, args, struct, \ |
354 | assign, print, reg, unreg) \ | 369 | assign, print, reg, unreg) \ |
355 | 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)) | ||
375 | |||
376 | #define TRACE_EVENT_FLAGS(event, flag) | ||
356 | 377 | ||
357 | #endif /* ifdef TRACE_EVENT (see note above) */ | 378 | #endif /* ifdef TRACE_EVENT (see note above) */ |