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.h53
1 files changed, 37 insertions, 16 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index a3d46151be19..e46a7b34037c 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -8,7 +8,7 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/kallsyms.h> 9#include <linux/kallsyms.h>
10 10
11#ifdef CONFIG_FTRACE 11#ifdef CONFIG_FUNCTION_TRACER
12 12
13extern int ftrace_enabled; 13extern int ftrace_enabled;
14extern int 14extern int
@@ -36,16 +36,14 @@ void clear_ftrace_function(void);
36 36
37extern void ftrace_stub(unsigned long a0, unsigned long a1); 37extern void ftrace_stub(unsigned long a0, unsigned long a1);
38 38
39#else /* !CONFIG_FTRACE */ 39#else /* !CONFIG_FUNCTION_TRACER */
40# define register_ftrace_function(ops) do { } while (0) 40# define register_ftrace_function(ops) do { } while (0)
41# define unregister_ftrace_function(ops) do { } while (0) 41# define unregister_ftrace_function(ops) do { } while (0)
42# define clear_ftrace_function(ops) do { } while (0) 42# define clear_ftrace_function(ops) do { } while (0)
43static inline void ftrace_kill_atomic(void) { } 43static inline void ftrace_kill(void) { }
44#endif /* CONFIG_FTRACE */ 44#endif /* CONFIG_FUNCTION_TRACER */
45 45
46#ifdef CONFIG_DYNAMIC_FTRACE 46#ifdef CONFIG_DYNAMIC_FTRACE
47# define FTRACE_HASHBITS 10
48# define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
49 47
50enum { 48enum {
51 FTRACE_FL_FREE = (1 << 0), 49 FTRACE_FL_FREE = (1 << 0),
@@ -58,9 +56,9 @@ enum {
58}; 56};
59 57
60struct dyn_ftrace { 58struct dyn_ftrace {
61 struct hlist_node node; 59 struct list_head list;
62 unsigned long ip; /* address of mcount call-site */ 60 unsigned long ip; /* address of mcount call-site */
63 unsigned long flags; 61 unsigned long flags;
64}; 62};
65 63
66int ftrace_force_update(void); 64int ftrace_force_update(void);
@@ -71,14 +69,36 @@ extern int ftrace_ip_converted(unsigned long ip);
71extern unsigned char *ftrace_nop_replace(void); 69extern unsigned char *ftrace_nop_replace(void);
72extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); 70extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
73extern int ftrace_dyn_arch_init(void *data); 71extern int ftrace_dyn_arch_init(void *data);
74extern int ftrace_mcount_set(unsigned long *data);
75extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
76 unsigned char *new_code);
77extern int ftrace_update_ftrace_func(ftrace_func_t func); 72extern int ftrace_update_ftrace_func(ftrace_func_t func);
78extern void ftrace_caller(void); 73extern void ftrace_caller(void);
79extern void ftrace_call(void); 74extern void ftrace_call(void);
80extern void mcount_call(void); 75extern void mcount_call(void);
81 76
77/* May be defined in arch */
78extern int ftrace_arch_read_dyn_info(char *buf, int size);
79
80/**
81 * ftrace_modify_code - modify code segment
82 * @ip: the address of the code segment
83 * @old_code: the contents of what is expected to be there
84 * @new_code: the code to patch in
85 *
86 * This is a very sensitive operation and great care needs
87 * to be taken by the arch. The operation should carefully
88 * read the location, check to see if what is read is indeed
89 * what we expect it to be, and then on success of the compare,
90 * it should write to the location.
91 *
92 * Return must be:
93 * 0 on success
94 * -EFAULT on error reading the location
95 * -EINVAL on a failed compare of the contents
96 * -EPERM on error writing to the location
97 * Any other value will be considered a failure.
98 */
99extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
100 unsigned char *new_code);
101
82extern int skip_trace(unsigned long ip); 102extern int skip_trace(unsigned long ip);
83 103
84extern void ftrace_release(void *start, unsigned long size); 104extern void ftrace_release(void *start, unsigned long size);
@@ -97,11 +117,10 @@ static inline void ftrace_release(void *start, unsigned long size) { }
97 117
98/* totally disable ftrace - can not re-enable after this */ 118/* totally disable ftrace - can not re-enable after this */
99void ftrace_kill(void); 119void ftrace_kill(void);
100void ftrace_kill_atomic(void);
101 120
102static inline void tracer_disable(void) 121static inline void tracer_disable(void)
103{ 122{
104#ifdef CONFIG_FTRACE 123#ifdef CONFIG_FUNCTION_TRACER
105 ftrace_enabled = 0; 124 ftrace_enabled = 0;
106#endif 125#endif
107} 126}
@@ -113,7 +132,7 @@ static inline void tracer_disable(void)
113 */ 132 */
114static inline int __ftrace_enabled_save(void) 133static inline int __ftrace_enabled_save(void)
115{ 134{
116#ifdef CONFIG_FTRACE 135#ifdef CONFIG_FUNCTION_TRACER
117 int saved_ftrace_enabled = ftrace_enabled; 136 int saved_ftrace_enabled = ftrace_enabled;
118 ftrace_enabled = 0; 137 ftrace_enabled = 0;
119 return saved_ftrace_enabled; 138 return saved_ftrace_enabled;
@@ -124,7 +143,7 @@ static inline int __ftrace_enabled_save(void)
124 143
125static inline void __ftrace_enabled_restore(int enabled) 144static inline void __ftrace_enabled_restore(int enabled)
126{ 145{
127#ifdef CONFIG_FTRACE 146#ifdef CONFIG_FUNCTION_TRACER
128 ftrace_enabled = enabled; 147 ftrace_enabled = enabled;
129#endif 148#endif
130} 149}
@@ -165,6 +184,8 @@ static inline void __ftrace_enabled_restore(int enabled)
165#endif 184#endif
166 185
167#ifdef CONFIG_TRACING 186#ifdef CONFIG_TRACING
187extern int ftrace_dump_on_oops;
188
168extern void 189extern void
169ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); 190ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
170 191