diff options
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r-- | include/linux/ftrace.h | 53 |
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 | ||
13 | extern int ftrace_enabled; | 13 | extern int ftrace_enabled; |
14 | extern int | 14 | extern int |
@@ -36,16 +36,14 @@ void clear_ftrace_function(void); | |||
36 | 36 | ||
37 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | 37 | extern 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) |
43 | static inline void ftrace_kill_atomic(void) { } | 43 | static 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 | ||
50 | enum { | 48 | enum { |
51 | FTRACE_FL_FREE = (1 << 0), | 49 | FTRACE_FL_FREE = (1 << 0), |
@@ -58,9 +56,9 @@ enum { | |||
58 | }; | 56 | }; |
59 | 57 | ||
60 | struct dyn_ftrace { | 58 | struct 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 | ||
66 | int ftrace_force_update(void); | 64 | int ftrace_force_update(void); |
@@ -71,14 +69,36 @@ extern int ftrace_ip_converted(unsigned long ip); | |||
71 | extern unsigned char *ftrace_nop_replace(void); | 69 | extern unsigned char *ftrace_nop_replace(void); |
72 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); | 70 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); |
73 | extern int ftrace_dyn_arch_init(void *data); | 71 | extern int ftrace_dyn_arch_init(void *data); |
74 | extern int ftrace_mcount_set(unsigned long *data); | ||
75 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
76 | unsigned char *new_code); | ||
77 | extern int ftrace_update_ftrace_func(ftrace_func_t func); | 72 | extern int ftrace_update_ftrace_func(ftrace_func_t func); |
78 | extern void ftrace_caller(void); | 73 | extern void ftrace_caller(void); |
79 | extern void ftrace_call(void); | 74 | extern void ftrace_call(void); |
80 | extern void mcount_call(void); | 75 | extern void mcount_call(void); |
81 | 76 | ||
77 | /* May be defined in arch */ | ||
78 | extern 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 | */ | ||
99 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
100 | unsigned char *new_code); | ||
101 | |||
82 | extern int skip_trace(unsigned long ip); | 102 | extern int skip_trace(unsigned long ip); |
83 | 103 | ||
84 | extern void ftrace_release(void *start, unsigned long size); | 104 | extern 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 */ |
99 | void ftrace_kill(void); | 119 | void ftrace_kill(void); |
100 | void ftrace_kill_atomic(void); | ||
101 | 120 | ||
102 | static inline void tracer_disable(void) | 121 | static 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 | */ |
114 | static inline int __ftrace_enabled_save(void) | 133 | static 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 | ||
125 | static inline void __ftrace_enabled_restore(int enabled) | 144 | static 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 |
187 | extern int ftrace_dump_on_oops; | ||
188 | |||
168 | extern void | 189 | extern void |
169 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | 190 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); |
170 | 191 | ||