diff options
Diffstat (limited to 'include/linux/tracepoint.h')
| -rw-r--r-- | include/linux/tracepoint.h | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 812b2553dfd8..9d30ee469c2a 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * | 6 | * |
| 7 | * See Documentation/trace/tracepoints.txt. | 7 | * See Documentation/trace/tracepoints.txt. |
| 8 | * | 8 | * |
| 9 | * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 9 | * Copyright (C) 2008-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 10 | * | 10 | * |
| 11 | * Heavily inspired from the Linux Kernel Markers. | 11 | * Heavily inspired from the Linux Kernel Markers. |
| 12 | * | 12 | * |
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | struct module; | 22 | struct module; |
| 23 | struct tracepoint; | 23 | struct tracepoint; |
| 24 | struct notifier_block; | ||
| 24 | 25 | ||
| 25 | struct tracepoint_func { | 26 | struct tracepoint_func { |
| 26 | void *func; | 27 | void *func; |
| @@ -35,31 +36,38 @@ struct tracepoint { | |||
| 35 | struct tracepoint_func __rcu *funcs; | 36 | struct tracepoint_func __rcu *funcs; |
| 36 | }; | 37 | }; |
| 37 | 38 | ||
| 38 | /* | ||
| 39 | * Connect a probe to a tracepoint. | ||
| 40 | * Internal API, should not be used directly. | ||
| 41 | */ | ||
| 42 | extern int tracepoint_probe_register(const char *name, void *probe, void *data); | ||
| 43 | |||
| 44 | /* | ||
| 45 | * Disconnect a probe from a tracepoint. | ||
| 46 | * Internal API, should not be used directly. | ||
| 47 | */ | ||
| 48 | extern int | 39 | extern int |
| 49 | tracepoint_probe_unregister(const char *name, void *probe, void *data); | 40 | tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); |
| 41 | extern int | ||
| 42 | tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data); | ||
| 43 | extern void | ||
| 44 | for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), | ||
| 45 | void *priv); | ||
| 50 | 46 | ||
| 51 | #ifdef CONFIG_MODULES | 47 | #ifdef CONFIG_MODULES |
| 52 | struct tp_module { | 48 | struct tp_module { |
| 53 | struct list_head list; | 49 | struct list_head list; |
| 54 | unsigned int num_tracepoints; | 50 | struct module *mod; |
| 55 | struct tracepoint * const *tracepoints_ptrs; | ||
| 56 | }; | 51 | }; |
| 52 | |||
| 57 | bool trace_module_has_bad_taint(struct module *mod); | 53 | bool trace_module_has_bad_taint(struct module *mod); |
| 54 | extern int register_tracepoint_module_notifier(struct notifier_block *nb); | ||
| 55 | extern int unregister_tracepoint_module_notifier(struct notifier_block *nb); | ||
| 58 | #else | 56 | #else |
| 59 | static inline bool trace_module_has_bad_taint(struct module *mod) | 57 | static inline bool trace_module_has_bad_taint(struct module *mod) |
| 60 | { | 58 | { |
| 61 | return false; | 59 | return false; |
| 62 | } | 60 | } |
| 61 | static inline | ||
| 62 | int register_tracepoint_module_notifier(struct notifier_block *nb) | ||
| 63 | { | ||
| 64 | return 0; | ||
| 65 | } | ||
| 66 | static inline | ||
| 67 | int unregister_tracepoint_module_notifier(struct notifier_block *nb) | ||
| 68 | { | ||
| 69 | return 0; | ||
| 70 | } | ||
| 63 | #endif /* CONFIG_MODULES */ | 71 | #endif /* CONFIG_MODULES */ |
| 64 | 72 | ||
| 65 | /* | 73 | /* |
| @@ -72,6 +80,11 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 72 | synchronize_sched(); | 80 | synchronize_sched(); |
| 73 | } | 81 | } |
| 74 | 82 | ||
| 83 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS | ||
| 84 | extern void syscall_regfunc(void); | ||
| 85 | extern void syscall_unregfunc(void); | ||
| 86 | #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ | ||
| 87 | |||
| 75 | #define PARAMS(args...) args | 88 | #define PARAMS(args...) args |
| 76 | 89 | ||
| 77 | #endif /* _LINUX_TRACEPOINT_H */ | 90 | #endif /* _LINUX_TRACEPOINT_H */ |
| @@ -160,14 +173,14 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 160 | static inline int \ | 173 | static inline int \ |
| 161 | register_trace_##name(void (*probe)(data_proto), void *data) \ | 174 | register_trace_##name(void (*probe)(data_proto), void *data) \ |
| 162 | { \ | 175 | { \ |
| 163 | return tracepoint_probe_register(#name, (void *)probe, \ | 176 | return tracepoint_probe_register(&__tracepoint_##name, \ |
| 164 | data); \ | 177 | (void *)probe, data); \ |
| 165 | } \ | 178 | } \ |
| 166 | static inline int \ | 179 | static inline int \ |
| 167 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ | 180 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ |
| 168 | { \ | 181 | { \ |
| 169 | return tracepoint_probe_unregister(#name, (void *)probe, \ | 182 | return tracepoint_probe_unregister(&__tracepoint_##name,\ |
| 170 | data); \ | 183 | (void *)probe, data); \ |
| 171 | } \ | 184 | } \ |
| 172 | static inline void \ | 185 | static inline void \ |
| 173 | check_trace_callback_type_##name(void (*cb)(data_proto)) \ | 186 | check_trace_callback_type_##name(void (*cb)(data_proto)) \ |
