aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h66
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);
82extern void ftrace_stub(unsigned long a0, unsigned long a1); 87extern 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; })
96static inline void clear_ftrace_function(void) { }
88static inline void ftrace_kill(void) { } 97static inline void ftrace_kill(void) { }
89static inline void ftrace_stop(void) { } 98static inline void ftrace_stop(void) { }
90static inline void ftrace_start(void) { } 99static inline void ftrace_start(void) { }
@@ -237,11 +246,13 @@ extern int skip_trace(unsigned long ip);
237extern void ftrace_disable_daemon(void); 246extern void ftrace_disable_daemon(void);
238extern void ftrace_enable_daemon(void); 247extern void ftrace_enable_daemon(void);
239#else 248#else
240# define skip_trace(ip) ({ 0; }) 249static inline int skip_trace(unsigned long ip) { return 0; }
241# define ftrace_force_update() ({ 0; }) 250static inline int ftrace_force_update(void) { return 0; }
242# define ftrace_set_filter(buf, len, reset) do { } while (0) 251static 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}
254static inline void ftrace_disable_daemon(void) { }
255static inline void ftrace_enable_daemon(void) { }
245static inline void ftrace_release_mod(struct module *mod) {} 256static inline void ftrace_release_mod(struct module *mod) {}
246static inline int register_ftrace_command(struct ftrace_func_command *cmd) 257static 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*/
367typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
368typedef 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*/
404typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
405typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
406
407extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 418extern 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)
441static inline void ftrace_graph_init_task(struct task_struct *t) { } 452static inline void ftrace_graph_init_task(struct task_struct *t) { }
442static inline void ftrace_graph_exit_task(struct task_struct *t) { } 453static inline void ftrace_graph_exit_task(struct task_struct *t) { }
443 454
455static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
456 trace_func_graph_ent_t entryfunc)
457{
458 return -1;
459}
460static inline void unregister_ftrace_graph(void) { }
461
444static inline int task_curr_ret_stack(struct task_struct *tsk) 462static 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
495extern int ftrace_dump_on_oops; 513enum ftrace_dump_mode;
514
515extern 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
509void trace_hw_branch(u64 from, u64 to);
510void trace_hw_branch_oops(void);
511
512#else /* CONFIG_HW_BRANCH_TRACER */
513
514static inline void trace_hw_branch(u64 from, u64 to) {}
515static 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
521unsigned long arch_syscall_addr(int nr); 529unsigned long arch_syscall_addr(int nr);