aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2014-09-17 03:07:03 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2014-11-09 17:59:27 -0500
commit7d56c65a6ff9065c459fc63c509950d8ea66e00c (patch)
tree77fac333d96da3f1791de1c27b5fbfede304c560 /arch/powerpc/kernel
parent6e4c632cdff7bf0238a2543dfe98bd1ad40313c2 (diff)
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: Anton Blanchard <anton@samba.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/entry_64.S24
-rw-r--r--arch/powerpc/kernel/ftrace.c14
-rw-r--r--arch/powerpc/kernel/process.c9
3 files changed, 4 insertions, 43 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 0905c8da90f1..66f7ed32848f 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -1241,28 +1241,6 @@ _GLOBAL(ftrace_graph_caller)
1241 1241
1242_GLOBAL(return_to_handler) 1242_GLOBAL(return_to_handler)
1243 /* need to save return values */ 1243 /* need to save return values */
1244 std r4, -24(r1)
1245 std r3, -16(r1)
1246 std r31, -8(r1)
1247 mr r31, r1
1248 stdu r1, -112(r1)
1249
1250 bl ftrace_return_to_handler
1251 nop
1252
1253 /* return value has real return address */
1254 mtlr r3
1255
1256 ld r1, 0(r1)
1257 ld r4, -24(r1)
1258 ld r3, -16(r1)
1259 ld r31, -8(r1)
1260
1261 /* Jump back to real return address */
1262 blr
1263
1264_GLOBAL(mod_return_to_handler)
1265 /* need to save return values */
1266 std r4, -32(r1) 1244 std r4, -32(r1)
1267 std r3, -24(r1) 1245 std r3, -24(r1)
1268 /* save TOC */ 1246 /* save TOC */
@@ -1272,7 +1250,7 @@ _GLOBAL(mod_return_to_handler)
1272 stdu r1, -112(r1) 1250 stdu r1, -112(r1)
1273 1251
1274 /* 1252 /*
1275 * We are in a module using the module's TOC. 1253 * We might be called from a module.
1276 * Switch to our TOC to run inside the core kernel. 1254 * Switch to our TOC to run inside the core kernel.
1277 */ 1255 */
1278 ld r2, PACATOC(r13) 1256 ld r2, PACATOC(r13)
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 390311c0f03d..abf79213c356 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -510,10 +510,6 @@ int ftrace_disable_ftrace_graph_caller(void)
510} 510}
511#endif /* CONFIG_DYNAMIC_FTRACE */ 511#endif /* CONFIG_DYNAMIC_FTRACE */
512 512
513#ifdef CONFIG_PPC64
514extern void mod_return_to_handler(void);
515#endif
516
517/* 513/*
518 * Hook the return address and push it in the stack of return addrs 514 * Hook the return address and push it in the stack of return addrs
519 * in current thread info. 515 * in current thread info.
@@ -523,7 +519,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
523 unsigned long old; 519 unsigned long old;
524 int faulted; 520 int faulted;
525 struct ftrace_graph_ent trace; 521 struct ftrace_graph_ent trace;
526 unsigned long return_hooker = (unsigned long)&return_to_handler; 522 unsigned long return_hooker;
527 523
528 if (unlikely(ftrace_graph_is_dead())) 524 if (unlikely(ftrace_graph_is_dead()))
529 return; 525 return;
@@ -531,13 +527,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
531 if (unlikely(atomic_read(&current->tracing_graph_pause))) 527 if (unlikely(atomic_read(&current->tracing_graph_pause)))
532 return; 528 return;
533 529
534#ifdef CONFIG_PPC64 530 return_hooker = ppc_function_entry(return_to_handler);
535 /* non core kernel code needs to save and restore the TOC */
536 if (REGION_ID(self_addr) != KERNEL_REGION_ID)
537 return_hooker = (unsigned long)&mod_return_to_handler;
538#endif
539
540 return_hooker = ppc_function_entry((void *)return_hooker);
541 531
542 /* 532 /*
543 * Protect against fault, even if it shouldn't 533 * Protect against fault, even if it shouldn't
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 8c2691e445bd..f6b82152e7aa 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1527,13 +1527,6 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1527 int curr_frame = current->curr_ret_stack; 1527 int curr_frame = current->curr_ret_stack;
1528 extern void return_to_handler(void); 1528 extern void return_to_handler(void);
1529 unsigned long rth = (unsigned long)return_to_handler; 1529 unsigned long rth = (unsigned long)return_to_handler;
1530 unsigned long mrth = -1;
1531#ifdef CONFIG_PPC64
1532 extern void mod_return_to_handler(void);
1533 rth = *(unsigned long *)rth;
1534 mrth = (unsigned long)mod_return_to_handler;
1535 mrth = *(unsigned long *)mrth;
1536#endif
1537#endif 1530#endif
1538 1531
1539 sp = (unsigned long) stack; 1532 sp = (unsigned long) stack;
@@ -1558,7 +1551,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1558 if (!firstframe || ip != lr) { 1551 if (!firstframe || ip != lr) {
1559 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); 1552 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
1560#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1553#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1561 if ((ip == rth || ip == mrth) && curr_frame >= 0) { 1554 if ((ip == rth) && curr_frame >= 0) {
1562 printk(" (%pS)", 1555 printk(" (%pS)",
1563 (void *)current->ret_stack[curr_frame].ret); 1556 (void *)current->ret_stack[curr_frame].ret);
1564 curr_frame--; 1557 curr_frame--;