diff options
Diffstat (limited to 'include/linux/tracepoint.h')
-rw-r--r-- | include/linux/tracepoint.h | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index a5f7f3ecafa3..696a339c592c 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -26,6 +26,7 @@ struct notifier_block; | |||
26 | struct tracepoint_func { | 26 | struct tracepoint_func { |
27 | void *func; | 27 | void *func; |
28 | void *data; | 28 | void *data; |
29 | int prio; | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | struct tracepoint { | 32 | struct tracepoint { |
@@ -42,9 +43,14 @@ struct trace_enum_map { | |||
42 | unsigned long enum_value; | 43 | unsigned long enum_value; |
43 | }; | 44 | }; |
44 | 45 | ||
46 | #define TRACEPOINT_DEFAULT_PRIO 10 | ||
47 | |||
45 | extern int | 48 | extern int |
46 | tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); | 49 | tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); |
47 | extern int | 50 | extern int |
51 | tracepoint_probe_register_prio(struct tracepoint *tp, void *probe, void *data, | ||
52 | int prio); | ||
53 | extern int | ||
48 | tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data); | 54 | tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data); |
49 | extern void | 55 | extern void |
50 | for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), | 56 | for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), |
@@ -111,7 +117,18 @@ extern void syscall_unregfunc(void); | |||
111 | #define TP_ARGS(args...) args | 117 | #define TP_ARGS(args...) args |
112 | #define TP_CONDITION(args...) args | 118 | #define TP_CONDITION(args...) args |
113 | 119 | ||
114 | #ifdef CONFIG_TRACEPOINTS | 120 | /* |
121 | * Individual subsystem my have a separate configuration to | ||
122 | * enable their tracepoints. By default, this file will create | ||
123 | * the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem | ||
124 | * wants to be able to disable its tracepoints from being created | ||
125 | * it can define NOTRACE before including the tracepoint headers. | ||
126 | */ | ||
127 | #if defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE) | ||
128 | #define TRACEPOINTS_ENABLED | ||
129 | #endif | ||
130 | |||
131 | #ifdef TRACEPOINTS_ENABLED | ||
115 | 132 | ||
116 | /* | 133 | /* |
117 | * it_func[0] is never NULL because there is at least one element in the array | 134 | * it_func[0] is never NULL because there is at least one element in the array |
@@ -167,10 +184,11 @@ extern void syscall_unregfunc(void); | |||
167 | * structure. Force alignment to the same alignment as the section start. | 184 | * structure. Force alignment to the same alignment as the section start. |
168 | * | 185 | * |
169 | * When lockdep is enabled, we make sure to always do the RCU portions of | 186 | * When lockdep is enabled, we make sure to always do the RCU portions of |
170 | * the tracepoint code, regardless of whether tracing is on or we match the | 187 | * the tracepoint code, regardless of whether tracing is on. However, |
171 | * condition. This lets us find RCU issues triggered with tracepoints even | 188 | * don't check if the condition is false, due to interaction with idle |
172 | * when this tracepoint is off. This code has no purpose other than poking | 189 | * instrumentation. This lets us find RCU issues triggered with tracepoints |
173 | * RCU a bit. | 190 | * even when this tracepoint is off. This code has no purpose other than |
191 | * poking RCU a bit. | ||
174 | */ | 192 | */ |
175 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 193 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
176 | extern struct tracepoint __tracepoint_##name; \ | 194 | extern struct tracepoint __tracepoint_##name; \ |
@@ -196,6 +214,13 @@ extern void syscall_unregfunc(void); | |||
196 | (void *)probe, data); \ | 214 | (void *)probe, data); \ |
197 | } \ | 215 | } \ |
198 | static inline int \ | 216 | static inline int \ |
217 | register_trace_prio_##name(void (*probe)(data_proto), void *data,\ | ||
218 | int prio) \ | ||
219 | { \ | ||
220 | return tracepoint_probe_register_prio(&__tracepoint_##name, \ | ||
221 | (void *)probe, data, prio); \ | ||
222 | } \ | ||
223 | static inline int \ | ||
199 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ | 224 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ |
200 | { \ | 225 | { \ |
201 | return tracepoint_probe_unregister(&__tracepoint_##name,\ | 226 | return tracepoint_probe_unregister(&__tracepoint_##name,\ |
@@ -234,7 +259,7 @@ extern void syscall_unregfunc(void); | |||
234 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ | 259 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ |
235 | EXPORT_SYMBOL(__tracepoint_##name) | 260 | EXPORT_SYMBOL(__tracepoint_##name) |
236 | 261 | ||
237 | #else /* !CONFIG_TRACEPOINTS */ | 262 | #else /* !TRACEPOINTS_ENABLED */ |
238 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 263 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
239 | static inline void trace_##name(proto) \ | 264 | static inline void trace_##name(proto) \ |
240 | { } \ | 265 | { } \ |
@@ -266,7 +291,7 @@ extern void syscall_unregfunc(void); | |||
266 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | 291 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
267 | #define EXPORT_TRACEPOINT_SYMBOL(name) | 292 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
268 | 293 | ||
269 | #endif /* CONFIG_TRACEPOINTS */ | 294 | #endif /* TRACEPOINTS_ENABLED */ |
270 | 295 | ||
271 | #ifdef CONFIG_TRACING | 296 | #ifdef CONFIG_TRACING |
272 | /** | 297 | /** |