diff options
Diffstat (limited to 'arch/arm/kernel/ftrace.c')
-rw-r--r-- | arch/arm/kernel/ftrace.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index 971ac8c36ea7..7a702a502871 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #define NOP 0xe8bd4000 /* pop {lr} */ | 24 | #define NOP 0xe8bd4000 /* pop {lr} */ |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
27 | #ifdef CONFIG_OLD_MCOUNT | 28 | #ifdef CONFIG_OLD_MCOUNT |
28 | #define OLD_MCOUNT_ADDR ((unsigned long) mcount) | 29 | #define OLD_MCOUNT_ADDR ((unsigned long) mcount) |
29 | #define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old) | 30 | #define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old) |
@@ -193,3 +194,36 @@ int __init ftrace_dyn_arch_init(void *data) | |||
193 | 194 | ||
194 | return 0; | 195 | return 0; |
195 | } | 196 | } |
197 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
198 | |||
199 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
200 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, | ||
201 | unsigned long frame_pointer) | ||
202 | { | ||
203 | unsigned long return_hooker = (unsigned long) &return_to_handler; | ||
204 | struct ftrace_graph_ent trace; | ||
205 | unsigned long old; | ||
206 | int err; | ||
207 | |||
208 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | ||
209 | return; | ||
210 | |||
211 | old = *parent; | ||
212 | *parent = return_hooker; | ||
213 | |||
214 | err = ftrace_push_return_trace(old, self_addr, &trace.depth, | ||
215 | frame_pointer); | ||
216 | if (err == -EBUSY) { | ||
217 | *parent = old; | ||
218 | return; | ||
219 | } | ||
220 | |||
221 | trace.func = self_addr; | ||
222 | |||
223 | /* Only trace if the calling function expects to */ | ||
224 | if (!ftrace_graph_entry(&trace)) { | ||
225 | current->curr_ret_stack--; | ||
226 | *parent = old; | ||
227 | } | ||
228 | } | ||
229 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||