Commit 7d56c65a authored by Anton Blanchard's avatar Anton Blanchard Committed by Michael Ellerman

powerpc/ftrace: Remove mod_return_to_handler

mod_return_to_handler is the same as return_to_handler, except
it handles the change of the TOC (r2). Add this into
return_to_handler and remove mod_return_to_handler.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6e4c632c
...@@ -1240,28 +1240,6 @@ _GLOBAL(ftrace_graph_caller) ...@@ -1240,28 +1240,6 @@ _GLOBAL(ftrace_graph_caller)
blr blr
_GLOBAL(return_to_handler) _GLOBAL(return_to_handler)
/* need to save return values */
std r4, -24(r1)
std r3, -16(r1)
std r31, -8(r1)
mr r31, r1
stdu r1, -112(r1)
bl ftrace_return_to_handler
nop
/* return value has real return address */
mtlr r3
ld r1, 0(r1)
ld r4, -24(r1)
ld r3, -16(r1)
ld r31, -8(r1)
/* Jump back to real return address */
blr
_GLOBAL(mod_return_to_handler)
/* need to save return values */ /* need to save return values */
std r4, -32(r1) std r4, -32(r1)
std r3, -24(r1) std r3, -24(r1)
...@@ -1272,7 +1250,7 @@ _GLOBAL(mod_return_to_handler) ...@@ -1272,7 +1250,7 @@ _GLOBAL(mod_return_to_handler)
stdu r1, -112(r1) stdu r1, -112(r1)
/* /*
* We are in a module using the module's TOC. * We might be called from a module.
* Switch to our TOC to run inside the core kernel. * Switch to our TOC to run inside the core kernel.
*/ */
ld r2, PACATOC(r13) ld r2, PACATOC(r13)
......
...@@ -510,10 +510,6 @@ int ftrace_disable_ftrace_graph_caller(void) ...@@ -510,10 +510,6 @@ int ftrace_disable_ftrace_graph_caller(void)
} }
#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_DYNAMIC_FTRACE */
#ifdef CONFIG_PPC64
extern void mod_return_to_handler(void);
#endif
/* /*
* Hook the return address and push it in the stack of return addrs * Hook the return address and push it in the stack of return addrs
* in current thread info. * in current thread info.
...@@ -523,7 +519,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) ...@@ -523,7 +519,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
unsigned long old; unsigned long old;
int faulted; int faulted;
struct ftrace_graph_ent trace; struct ftrace_graph_ent trace;
unsigned long return_hooker = (unsigned long)&return_to_handler; unsigned long return_hooker;
if (unlikely(ftrace_graph_is_dead())) if (unlikely(ftrace_graph_is_dead()))
return; return;
...@@ -531,13 +527,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) ...@@ -531,13 +527,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
if (unlikely(atomic_read(&current->tracing_graph_pause))) if (unlikely(atomic_read(&current->tracing_graph_pause)))
return; return;
#ifdef CONFIG_PPC64 return_hooker = ppc_function_entry(return_to_handler);
/* non core kernel code needs to save and restore the TOC */
if (REGION_ID(self_addr) != KERNEL_REGION_ID)
return_hooker = (unsigned long)&mod_return_to_handler;
#endif
return_hooker = ppc_function_entry((void *)return_hooker);
/* /*
* Protect against fault, even if it shouldn't * Protect against fault, even if it shouldn't
......
...@@ -1527,13 +1527,6 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) ...@@ -1527,13 +1527,6 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
int curr_frame = current->curr_ret_stack; int curr_frame = current->curr_ret_stack;
extern void return_to_handler(void); extern void return_to_handler(void);
unsigned long rth = (unsigned long)return_to_handler; unsigned long rth = (unsigned long)return_to_handler;
unsigned long mrth = -1;
#ifdef CONFIG_PPC64
extern void mod_return_to_handler(void);
rth = *(unsigned long *)rth;
mrth = (unsigned long)mod_return_to_handler;
mrth = *(unsigned long *)mrth;
#endif
#endif #endif
sp = (unsigned long) stack; sp = (unsigned long) stack;
...@@ -1558,7 +1551,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) ...@@ -1558,7 +1551,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
if (!firstframe || ip != lr) { if (!firstframe || ip != lr) {
printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
if ((ip == rth || ip == mrth) && curr_frame >= 0) { if ((ip == rth) && curr_frame >= 0) {
printk(" (%pS)", printk(" (%pS)",
(void *)current->ret_stack[curr_frame].ret); (void *)current->ret_stack[curr_frame].ret);
curr_frame--; curr_frame--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment