diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ftrace.h | 49 | ||||
| -rw-r--r-- | include/linux/kernel.h | 11 | ||||
| -rw-r--r-- | include/linux/ring_buffer.h | 4 | ||||
| -rw-r--r-- | include/linux/tracepoint.h | 114 |
4 files changed, 103 insertions, 75 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index cc12b3c556b3..41e46330d9be 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -82,9 +82,13 @@ void clear_ftrace_function(void); | |||
| 82 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | 82 | extern void ftrace_stub(unsigned long a0, unsigned long a1); |
| 83 | 83 | ||
| 84 | #else /* !CONFIG_FUNCTION_TRACER */ | 84 | #else /* !CONFIG_FUNCTION_TRACER */ |
| 85 | # define register_ftrace_function(ops) do { } while (0) | 85 | /* |
| 86 | # define unregister_ftrace_function(ops) do { } while (0) | 86 | * (un)register_ftrace_function must be a macro since the ops parameter |
| 87 | # define clear_ftrace_function(ops) do { } while (0) | 87 | * must not be evaluated. |
| 88 | */ | ||
| 89 | #define register_ftrace_function(ops) ({ 0; }) | ||
| 90 | #define unregister_ftrace_function(ops) ({ 0; }) | ||
| 91 | static inline void clear_ftrace_function(void) { } | ||
| 88 | static inline void ftrace_kill(void) { } | 92 | static inline void ftrace_kill(void) { } |
| 89 | static inline void ftrace_stop(void) { } | 93 | static inline void ftrace_stop(void) { } |
| 90 | static inline void ftrace_start(void) { } | 94 | static inline void ftrace_start(void) { } |
| @@ -237,11 +241,13 @@ extern int skip_trace(unsigned long ip); | |||
| 237 | extern void ftrace_disable_daemon(void); | 241 | extern void ftrace_disable_daemon(void); |
| 238 | extern void ftrace_enable_daemon(void); | 242 | extern void ftrace_enable_daemon(void); |
| 239 | #else | 243 | #else |
| 240 | # define skip_trace(ip) ({ 0; }) | 244 | static inline int skip_trace(unsigned long ip) { return 0; } |
| 241 | # define ftrace_force_update() ({ 0; }) | 245 | static inline int ftrace_force_update(void) { return 0; } |
| 242 | # define ftrace_set_filter(buf, len, reset) do { } while (0) | 246 | static inline void ftrace_set_filter(unsigned char *buf, int len, int reset) |
| 243 | # define ftrace_disable_daemon() do { } while (0) | 247 | { |
| 244 | # define ftrace_enable_daemon() do { } while (0) | 248 | } |
| 249 | static inline void ftrace_disable_daemon(void) { } | ||
| 250 | static inline void ftrace_enable_daemon(void) { } | ||
| 245 | static inline void ftrace_release_mod(struct module *mod) {} | 251 | static inline void ftrace_release_mod(struct module *mod) {} |
| 246 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) | 252 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) |
| 247 | { | 253 | { |
| @@ -314,16 +320,16 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
| 314 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); | 320 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); |
| 315 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); | 321 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); |
| 316 | #else | 322 | #else |
| 317 | # define time_hardirqs_on(a0, a1) do { } while (0) | 323 | static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { } |
| 318 | # define time_hardirqs_off(a0, a1) do { } while (0) | 324 | static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { } |
| 319 | #endif | 325 | #endif |
| 320 | 326 | ||
| 321 | #ifdef CONFIG_PREEMPT_TRACER | 327 | #ifdef CONFIG_PREEMPT_TRACER |
| 322 | extern void trace_preempt_on(unsigned long a0, unsigned long a1); | 328 | extern void trace_preempt_on(unsigned long a0, unsigned long a1); |
| 323 | extern void trace_preempt_off(unsigned long a0, unsigned long a1); | 329 | extern void trace_preempt_off(unsigned long a0, unsigned long a1); |
| 324 | #else | 330 | #else |
| 325 | # define trace_preempt_on(a0, a1) do { } while (0) | 331 | static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { } |
| 326 | # define trace_preempt_off(a0, a1) do { } while (0) | 332 | static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { } |
| 327 | #endif | 333 | #endif |
| 328 | 334 | ||
| 329 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 335 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| @@ -352,6 +358,10 @@ struct ftrace_graph_ret { | |||
| 352 | int depth; | 358 | int depth; |
| 353 | }; | 359 | }; |
| 354 | 360 | ||
| 361 | /* Type of the callback handlers for tracing function graph*/ | ||
| 362 | typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ | ||
| 363 | typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ | ||
| 364 | |||
| 355 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 365 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 356 | 366 | ||
| 357 | /* for init task */ | 367 | /* for init task */ |
| @@ -400,10 +410,6 @@ extern char __irqentry_text_end[]; | |||
| 400 | 410 | ||
| 401 | #define FTRACE_RETFUNC_DEPTH 50 | 411 | #define FTRACE_RETFUNC_DEPTH 50 |
| 402 | #define FTRACE_RETSTACK_ALLOC_SIZE 32 | 412 | #define FTRACE_RETSTACK_ALLOC_SIZE 32 |
| 403 | /* Type of the callback handlers for tracing function graph*/ | ||
| 404 | typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ | ||
| 405 | typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ | ||
| 406 | |||
| 407 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, | 413 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
| 408 | trace_func_graph_ent_t entryfunc); | 414 | trace_func_graph_ent_t entryfunc); |
| 409 | 415 | ||
| @@ -441,6 +447,13 @@ static inline void unpause_graph_tracing(void) | |||
| 441 | static inline void ftrace_graph_init_task(struct task_struct *t) { } | 447 | static inline void ftrace_graph_init_task(struct task_struct *t) { } |
| 442 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } | 448 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } |
| 443 | 449 | ||
| 450 | static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc, | ||
| 451 | trace_func_graph_ent_t entryfunc) | ||
| 452 | { | ||
| 453 | return -1; | ||
| 454 | } | ||
| 455 | static inline void unregister_ftrace_graph(void) { } | ||
| 456 | |||
| 444 | static inline int task_curr_ret_stack(struct task_struct *tsk) | 457 | static inline int task_curr_ret_stack(struct task_struct *tsk) |
| 445 | { | 458 | { |
| 446 | return -1; | 459 | return -1; |
| @@ -492,7 +505,9 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) | |||
| 492 | return tsk->trace & TSK_TRACE_FL_GRAPH; | 505 | return tsk->trace & TSK_TRACE_FL_GRAPH; |
| 493 | } | 506 | } |
| 494 | 507 | ||
| 495 | extern int ftrace_dump_on_oops; | 508 | enum ftrace_dump_mode; |
| 509 | |||
| 510 | extern enum ftrace_dump_mode ftrace_dump_on_oops; | ||
| 496 | 511 | ||
| 497 | #ifdef CONFIG_PREEMPT | 512 | #ifdef CONFIG_PREEMPT |
| 498 | #define INIT_TRACE_RECURSION .trace_recursion = 0, | 513 | #define INIT_TRACE_RECURSION .trace_recursion = 0, |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 9365227dbaf6..9fb1c1299032 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -490,6 +490,13 @@ static inline void tracing_off(void) { } | |||
| 490 | static inline void tracing_off_permanent(void) { } | 490 | static inline void tracing_off_permanent(void) { } |
| 491 | static inline int tracing_is_on(void) { return 0; } | 491 | static inline int tracing_is_on(void) { return 0; } |
| 492 | #endif | 492 | #endif |
| 493 | |||
| 494 | enum ftrace_dump_mode { | ||
| 495 | DUMP_NONE, | ||
| 496 | DUMP_ALL, | ||
| 497 | DUMP_ORIG, | ||
| 498 | }; | ||
| 499 | |||
| 493 | #ifdef CONFIG_TRACING | 500 | #ifdef CONFIG_TRACING |
| 494 | extern void tracing_start(void); | 501 | extern void tracing_start(void); |
| 495 | extern void tracing_stop(void); | 502 | extern void tracing_stop(void); |
| @@ -571,7 +578,7 @@ __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); | |||
| 571 | extern int | 578 | extern int |
| 572 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | 579 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); |
| 573 | 580 | ||
| 574 | extern void ftrace_dump(void); | 581 | extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); |
| 575 | #else | 582 | #else |
| 576 | static inline void | 583 | static inline void |
| 577 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | 584 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } |
| @@ -592,7 +599,7 @@ ftrace_vprintk(const char *fmt, va_list ap) | |||
| 592 | { | 599 | { |
| 593 | return 0; | 600 | return 0; |
| 594 | } | 601 | } |
| 595 | static inline void ftrace_dump(void) { } | 602 | static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } |
| 596 | #endif /* CONFIG_TRACING */ | 603 | #endif /* CONFIG_TRACING */ |
| 597 | 604 | ||
| 598 | /* | 605 | /* |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index c8297761e414..25b4f686d918 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
| @@ -127,7 +127,9 @@ ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts, | |||
| 127 | unsigned long *lost_events); | 127 | unsigned long *lost_events); |
| 128 | 128 | ||
| 129 | struct ring_buffer_iter * | 129 | struct ring_buffer_iter * |
| 130 | ring_buffer_read_start(struct ring_buffer *buffer, int cpu); | 130 | ring_buffer_read_prepare(struct ring_buffer *buffer, int cpu); |
| 131 | void ring_buffer_read_prepare_sync(void); | ||
| 132 | void ring_buffer_read_start(struct ring_buffer_iter *iter); | ||
| 131 | void ring_buffer_read_finish(struct ring_buffer_iter *iter); | 133 | void ring_buffer_read_finish(struct ring_buffer_iter *iter); |
| 132 | 134 | ||
| 133 | struct ring_buffer_event * | 135 | struct ring_buffer_event * |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 78b4bd3be496..1d85f9a6a199 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -33,6 +33,65 @@ struct tracepoint { | |||
| 33 | * Keep in sync with vmlinux.lds.h. | 33 | * Keep in sync with vmlinux.lds.h. |
| 34 | */ | 34 | */ |
| 35 | 35 | ||
| 36 | /* | ||
| 37 | * Connect a probe to a tracepoint. | ||
| 38 | * Internal API, should not be used directly. | ||
| 39 | */ | ||
| 40 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Disconnect a probe from a tracepoint. | ||
| 44 | * Internal API, should not be used directly. | ||
| 45 | */ | ||
| 46 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
| 47 | |||
| 48 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
| 49 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
| 50 | extern void tracepoint_probe_update_all(void); | ||
| 51 | |||
| 52 | struct tracepoint_iter { | ||
| 53 | struct module *module; | ||
| 54 | struct tracepoint *tracepoint; | ||
| 55 | }; | ||
| 56 | |||
| 57 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
| 58 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
| 59 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
| 60 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
| 61 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
| 62 | struct tracepoint *begin, struct tracepoint *end); | ||
| 63 | |||
| 64 | /* | ||
| 65 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
| 66 | * probe unregistration and the end of module exit to make sure there is no | ||
| 67 | * caller executing a probe when it is freed. | ||
| 68 | */ | ||
| 69 | static inline void tracepoint_synchronize_unregister(void) | ||
| 70 | { | ||
| 71 | synchronize_sched(); | ||
| 72 | } | ||
| 73 | |||
| 74 | #define PARAMS(args...) args | ||
| 75 | |||
| 76 | #ifdef CONFIG_TRACEPOINTS | ||
| 77 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
| 78 | struct tracepoint *end); | ||
| 79 | #else | ||
| 80 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
| 81 | struct tracepoint *end) | ||
| 82 | { } | ||
| 83 | #endif /* CONFIG_TRACEPOINTS */ | ||
| 84 | |||
| 85 | #endif /* _LINUX_TRACEPOINT_H */ | ||
| 86 | |||
| 87 | /* | ||
| 88 | * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include | ||
| 89 | * file ifdef protection. | ||
| 90 | * This is due to the way trace events work. If a file includes two | ||
| 91 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
| 92 | * will override the TRACE_EVENT and break the second include. | ||
| 93 | */ | ||
| 94 | |||
| 36 | #ifndef DECLARE_TRACE | 95 | #ifndef DECLARE_TRACE |
| 37 | 96 | ||
| 38 | #define TP_PROTO(args...) args | 97 | #define TP_PROTO(args...) args |
| @@ -96,9 +155,6 @@ struct tracepoint { | |||
| 96 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ | 155 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ |
| 97 | EXPORT_SYMBOL(__tracepoint_##name) | 156 | EXPORT_SYMBOL(__tracepoint_##name) |
| 98 | 157 | ||
| 99 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
| 100 | struct tracepoint *end); | ||
| 101 | |||
| 102 | #else /* !CONFIG_TRACEPOINTS */ | 158 | #else /* !CONFIG_TRACEPOINTS */ |
| 103 | #define DECLARE_TRACE(name, proto, args) \ | 159 | #define DECLARE_TRACE(name, proto, args) \ |
| 104 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ | 160 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ |
| @@ -119,61 +175,9 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin, | |||
| 119 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | 175 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
| 120 | #define EXPORT_TRACEPOINT_SYMBOL(name) | 176 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
| 121 | 177 | ||
| 122 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
| 123 | struct tracepoint *end) | ||
| 124 | { } | ||
| 125 | #endif /* CONFIG_TRACEPOINTS */ | 178 | #endif /* CONFIG_TRACEPOINTS */ |
| 126 | #endif /* DECLARE_TRACE */ | 179 | #endif /* DECLARE_TRACE */ |
| 127 | 180 | ||
| 128 | /* | ||
| 129 | * Connect a probe to a tracepoint. | ||
| 130 | * Internal API, should not be used directly. | ||
| 131 | */ | ||
| 132 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
| 133 | |||
| 134 | /* | ||
| 135 | * Disconnect a probe from a tracepoint. | ||
| 136 | * Internal API, should not be used directly. | ||
| 137 | */ | ||
| 138 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
| 139 | |||
| 140 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
| 141 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
| 142 | extern void tracepoint_probe_update_all(void); | ||
| 143 | |||
| 144 | struct tracepoint_iter { | ||
| 145 | struct module *module; | ||
| 146 | struct tracepoint *tracepoint; | ||
| 147 | }; | ||
| 148 | |||
| 149 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
| 150 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
| 151 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
| 152 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
| 153 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
| 154 | struct tracepoint *begin, struct tracepoint *end); | ||
| 155 | |||
| 156 | /* | ||
| 157 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
| 158 | * probe unregistration and the end of module exit to make sure there is no | ||
| 159 | * caller executing a probe when it is freed. | ||
| 160 | */ | ||
| 161 | static inline void tracepoint_synchronize_unregister(void) | ||
| 162 | { | ||
| 163 | synchronize_sched(); | ||
| 164 | } | ||
| 165 | |||
| 166 | #define PARAMS(args...) args | ||
| 167 | |||
| 168 | #endif /* _LINUX_TRACEPOINT_H */ | ||
| 169 | |||
| 170 | /* | ||
| 171 | * Note: we keep the TRACE_EVENT outside the include file ifdef protection. | ||
| 172 | * This is due to the way trace events work. If a file includes two | ||
| 173 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
| 174 | * will override the TRACE_EVENT and break the second include. | ||
| 175 | */ | ||
| 176 | |||
| 177 | #ifndef TRACE_EVENT | 181 | #ifndef TRACE_EVENT |
| 178 | /* | 182 | /* |
| 179 | * For use with the TRACE_EVENT macro: | 183 | * For use with the TRACE_EVENT macro: |
