diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-12-22 06:46:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-12-22 11:12:08 -0500 |
commit | 9fb67204d7a00a6444bc121f221527034613d338 (patch) | |
tree | 1f8e9715955a41577a2ee14be922683f93aa0e12 /include | |
parent | 8c1df4002aa425973d7d25ffa56c042acd953bed (diff) | |
parent | 287050d390264402e11bea8b811859e42e8faa29 (diff) |
Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ftrace_event.h | 4 | ||||
-rw-r--r-- | include/linux/tracepoint.h | 29 | ||||
-rw-r--r-- | include/trace/define_trace.h | 15 | ||||
-rw-r--r-- | include/trace/ftrace.h | 14 |
4 files changed, 52 insertions, 10 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 725bf6bd39f7..47e3997f7b5c 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -225,6 +225,10 @@ enum { | |||
225 | FILTER_PTR_STRING, | 225 | FILTER_PTR_STRING, |
226 | }; | 226 | }; |
227 | 227 | ||
228 | #define EVENT_STORAGE_SIZE 128 | ||
229 | extern struct mutex event_storage_mutex; | ||
230 | extern char event_storage[EVENT_STORAGE_SIZE]; | ||
231 | |||
228 | extern int trace_event_raw_init(struct ftrace_event_call *call); | 232 | extern int trace_event_raw_init(struct ftrace_event_call *call); |
229 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, | 233 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, |
230 | const char *name, int offset, int size, | 234 | const char *name, int offset, int size, |
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 | ||
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index e718a917d897..e16610c208c9 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -296,13 +296,19 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | |||
296 | 296 | ||
297 | #undef __array | 297 | #undef __array |
298 | #define __array(type, item, len) \ | 298 | #define __array(type, item, len) \ |
299 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 299 | do { \ |
300 | 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, \ | ||
301 | offsetof(typeof(field), item), \ | 305 | offsetof(typeof(field), item), \ |
302 | sizeof(field.item), \ | 306 | sizeof(field.item), \ |
303 | is_signed_type(type), FILTER_OTHER); \ | 307 | is_signed_type(type), FILTER_OTHER); \ |
304 | if (ret) \ | 308 | mutex_unlock(&event_storage_mutex); \ |
305 | return ret; | 309 | if (ret) \ |
310 | return ret; \ | ||
311 | } while (0); | ||
306 | 312 | ||
307 | #undef __dynamic_array | 313 | #undef __dynamic_array |
308 | #define __dynamic_array(type, item, len) \ | 314 | #define __dynamic_array(type, item, len) \ |