1 #ifndef _LINUX_FTRACE_H
2 #define _LINUX_FTRACE_H
6 #include <linux/linkage.h>
8 extern int ftrace_enabled;
10 ftrace_enable_sysctl(struct ctl_table *table, int write,
11 struct file *filp, void __user *buffer, size_t *lenp,
14 typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
18 struct ftrace_ops *next;
22 * The ftrace_ops must be a static and should also
23 * be read_mostly. These functions do modify read_mostly variables
24 * so use them sparely. Never free an ftrace_op or modify the
25 * next pointer after it has been registered. Even after unregistering
26 * it, the next pointer may still be used internally.
28 int register_ftrace_function(struct ftrace_ops *ops);
29 int unregister_ftrace_function(struct ftrace_ops *ops);
30 void clear_ftrace_function(void);
32 extern void ftrace_stub(unsigned long a0, unsigned long a1);
33 extern void mcount(void);
35 #else /* !CONFIG_FTRACE */
36 # define register_ftrace_function(ops) do { } while (0)
37 # define unregister_ftrace_function(ops) do { } while (0)
38 # define clear_ftrace_function(ops) do { } while (0)
39 #endif /* CONFIG_FTRACE */
41 #ifdef CONFIG_DYNAMIC_FTRACE
42 # define FTRACE_HASHBITS 10
43 # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
46 FTRACE_FL_FREE = (1 << 0),
47 FTRACE_FL_FAILED = (1 << 1),
48 FTRACE_FL_FILTER = (1 << 2),
49 FTRACE_FL_ENABLED = (1 << 3),
53 struct hlist_node node;
58 int ftrace_force_update(void);
59 void ftrace_set_filter(unsigned char *buf, int len, int reset);
62 extern int ftrace_ip_converted(unsigned long ip);
63 extern unsigned char *ftrace_nop_replace(void);
64 extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
65 extern int ftrace_dyn_arch_init(void *data);
66 extern int ftrace_mcount_set(unsigned long *data);
67 extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
68 unsigned char *new_code);
69 extern int ftrace_update_ftrace_func(ftrace_func_t func);
70 extern void ftrace_caller(void);
71 extern void ftrace_call(void);
72 extern void mcount_call(void);
74 # define ftrace_force_update() ({ 0; })
75 # define ftrace_set_filter(buf, len, reset) do { } while (0)
78 /* totally disable ftrace - can not re-enable after this */
79 void ftrace_kill(void);
81 static inline void tracer_disable(void)
88 #ifdef CONFIG_FRAME_POINTER
89 /* TODO: need to fix this for ARM */
90 # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
91 # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
92 # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
93 # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
94 # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
95 # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
96 # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
98 # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
99 # define CALLER_ADDR1 0UL
100 # define CALLER_ADDR2 0UL
101 # define CALLER_ADDR3 0UL
102 # define CALLER_ADDR4 0UL
103 # define CALLER_ADDR5 0UL
104 # define CALLER_ADDR6 0UL
107 #ifdef CONFIG_IRQSOFF_TRACER
108 extern void notrace time_hardirqs_on(unsigned long a0, unsigned long a1);
109 extern void notrace time_hardirqs_off(unsigned long a0, unsigned long a1);
111 # define time_hardirqs_on(a0, a1) do { } while (0)
112 # define time_hardirqs_off(a0, a1) do { } while (0)
115 #ifdef CONFIG_PREEMPT_TRACER
116 extern void notrace trace_preempt_on(unsigned long a0, unsigned long a1);
117 extern void notrace trace_preempt_off(unsigned long a0, unsigned long a1);
119 # define trace_preempt_on(a0, a1) do { } while (0)
120 # define trace_preempt_off(a0, a1) do { } while (0)
123 #endif /* _LINUX_FTRACE_H */