diff options
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r-- | include/linux/ftrace.h | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 01e6adea07ec..dcd6a7c3a435 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * Ftrace header. For implementation details beyond the random comments | ||
3 | * scattered below, see: Documentation/trace/ftrace-design.txt | ||
4 | */ | ||
5 | |||
1 | #ifndef _LINUX_FTRACE_H | 6 | #ifndef _LINUX_FTRACE_H |
2 | #define _LINUX_FTRACE_H | 7 | #define _LINUX_FTRACE_H |
3 | 8 | ||
@@ -82,9 +87,13 @@ void clear_ftrace_function(void); | |||
82 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | 87 | extern void ftrace_stub(unsigned long a0, unsigned long a1); |
83 | 88 | ||
84 | #else /* !CONFIG_FUNCTION_TRACER */ | 89 | #else /* !CONFIG_FUNCTION_TRACER */ |
85 | # define register_ftrace_function(ops) do { } while (0) | 90 | /* |
86 | # define unregister_ftrace_function(ops) do { } while (0) | 91 | * (un)register_ftrace_function must be a macro since the ops parameter |
87 | # define clear_ftrace_function(ops) do { } while (0) | 92 | * must not be evaluated. |
93 | */ | ||
94 | #define register_ftrace_function(ops) ({ 0; }) | ||
95 | #define unregister_ftrace_function(ops) ({ 0; }) | ||
96 | static inline void clear_ftrace_function(void) { } | ||
88 | static inline void ftrace_kill(void) { } | 97 | static inline void ftrace_kill(void) { } |
89 | static inline void ftrace_stop(void) { } | 98 | static inline void ftrace_stop(void) { } |
90 | static inline void ftrace_start(void) { } | 99 | static inline void ftrace_start(void) { } |
@@ -237,11 +246,13 @@ extern int skip_trace(unsigned long ip); | |||
237 | extern void ftrace_disable_daemon(void); | 246 | extern void ftrace_disable_daemon(void); |
238 | extern void ftrace_enable_daemon(void); | 247 | extern void ftrace_enable_daemon(void); |
239 | #else | 248 | #else |
240 | # define skip_trace(ip) ({ 0; }) | 249 | static inline int skip_trace(unsigned long ip) { return 0; } |
241 | # define ftrace_force_update() ({ 0; }) | 250 | static inline int ftrace_force_update(void) { return 0; } |
242 | # define ftrace_set_filter(buf, len, reset) do { } while (0) | 251 | static inline void ftrace_set_filter(unsigned char *buf, int len, int reset) |
243 | # define ftrace_disable_daemon() do { } while (0) | 252 | { |
244 | # define ftrace_enable_daemon() do { } while (0) | 253 | } |
254 | static inline void ftrace_disable_daemon(void) { } | ||
255 | static inline void ftrace_enable_daemon(void) { } | ||
245 | static inline void ftrace_release_mod(struct module *mod) {} | 256 | static inline void ftrace_release_mod(struct module *mod) {} |
246 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) | 257 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) |
247 | { | 258 | { |
@@ -314,16 +325,16 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
314 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); | 325 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); |
315 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); | 326 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); |
316 | #else | 327 | #else |
317 | # define time_hardirqs_on(a0, a1) do { } while (0) | 328 | static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { } |
318 | # define time_hardirqs_off(a0, a1) do { } while (0) | 329 | static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { } |
319 | #endif | 330 | #endif |
320 | 331 | ||
321 | #ifdef CONFIG_PREEMPT_TRACER | 332 | #ifdef CONFIG_PREEMPT_TRACER |
322 | extern void trace_preempt_on(unsigned long a0, unsigned long a1); | 333 | extern void trace_preempt_on(unsigned long a0, unsigned long a1); |
323 | extern void trace_preempt_off(unsigned long a0, unsigned long a1); | 334 | extern void trace_preempt_off(unsigned long a0, unsigned long a1); |
324 | #else | 335 | #else |
325 | # define trace_preempt_on(a0, a1) do { } while (0) | 336 | static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { } |
326 | # define trace_preempt_off(a0, a1) do { } while (0) | 337 | static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { } |
327 | #endif | 338 | #endif |
328 | 339 | ||
329 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 340 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
@@ -352,6 +363,10 @@ struct ftrace_graph_ret { | |||
352 | int depth; | 363 | int depth; |
353 | }; | 364 | }; |
354 | 365 | ||
366 | /* Type of the callback handlers for tracing function graph*/ | ||
367 | typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ | ||
368 | typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ | ||
369 | |||
355 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 370 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
356 | 371 | ||
357 | /* for init task */ | 372 | /* for init task */ |
@@ -400,10 +415,6 @@ extern char __irqentry_text_end[]; | |||
400 | 415 | ||
401 | #define FTRACE_RETFUNC_DEPTH 50 | 416 | #define FTRACE_RETFUNC_DEPTH 50 |
402 | #define FTRACE_RETSTACK_ALLOC_SIZE 32 | 417 | #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, | 418 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
408 | trace_func_graph_ent_t entryfunc); | 419 | trace_func_graph_ent_t entryfunc); |
409 | 420 | ||
@@ -441,6 +452,13 @@ static inline void unpause_graph_tracing(void) | |||
441 | static inline void ftrace_graph_init_task(struct task_struct *t) { } | 452 | static inline void ftrace_graph_init_task(struct task_struct *t) { } |
442 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } | 453 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } |
443 | 454 | ||
455 | static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc, | ||
456 | trace_func_graph_ent_t entryfunc) | ||
457 | { | ||
458 | return -1; | ||
459 | } | ||
460 | static inline void unregister_ftrace_graph(void) { } | ||
461 | |||
444 | static inline int task_curr_ret_stack(struct task_struct *tsk) | 462 | static inline int task_curr_ret_stack(struct task_struct *tsk) |
445 | { | 463 | { |
446 | return -1; | 464 | return -1; |
@@ -492,7 +510,9 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) | |||
492 | return tsk->trace & TSK_TRACE_FL_GRAPH; | 510 | return tsk->trace & TSK_TRACE_FL_GRAPH; |
493 | } | 511 | } |
494 | 512 | ||
495 | extern int ftrace_dump_on_oops; | 513 | enum ftrace_dump_mode; |
514 | |||
515 | extern enum ftrace_dump_mode ftrace_dump_on_oops; | ||
496 | 516 | ||
497 | #ifdef CONFIG_PREEMPT | 517 | #ifdef CONFIG_PREEMPT |
498 | #define INIT_TRACE_RECURSION .trace_recursion = 0, | 518 | #define INIT_TRACE_RECURSION .trace_recursion = 0, |
@@ -504,18 +524,6 @@ extern int ftrace_dump_on_oops; | |||
504 | #define INIT_TRACE_RECURSION | 524 | #define INIT_TRACE_RECURSION |
505 | #endif | 525 | #endif |
506 | 526 | ||
507 | #ifdef CONFIG_HW_BRANCH_TRACER | ||
508 | |||
509 | void trace_hw_branch(u64 from, u64 to); | ||
510 | void trace_hw_branch_oops(void); | ||
511 | |||
512 | #else /* CONFIG_HW_BRANCH_TRACER */ | ||
513 | |||
514 | static inline void trace_hw_branch(u64 from, u64 to) {} | ||
515 | static inline void trace_hw_branch_oops(void) {} | ||
516 | |||
517 | #endif /* CONFIG_HW_BRANCH_TRACER */ | ||
518 | |||
519 | #ifdef CONFIG_FTRACE_SYSCALLS | 527 | #ifdef CONFIG_FTRACE_SYSCALLS |
520 | 528 | ||
521 | unsigned long arch_syscall_addr(int nr); | 529 | unsigned long arch_syscall_addr(int nr); |