Re: [PATCH 2/3] powerpc/ftrace: Remove mod_return_to_handler

2014-09-23 Thread Steven Rostedt
On Wed, 17 Sep 2014 17:07:03 +1000
Anton Blanchard an...@samba.org wrote:

 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.

Adding this patch actually gave me some more output. Funny that?

electra login: INFO: rcu_sched self-detected stall on CPU { 1}  (t=5250 jiffies 
g=3579 c=3578 q=7)
Task dump for CPU 1:
trace-cmd   R  running task0  3553   3550 0x8014
Call Trace:
[c54a6ce0] [c0012b34] .show_stack+0x104/0x260 (unreliable)
[c54a6dc0] [c00c2270] .sched_show_task+0xd0/0x150
[c54a6e40] [c00eedb0] .rcu_dump_cpu_stacks+0xe0/0x150
[c54a6ee0] [c00f2a48] .rcu_check_callbacks+0x4f8/0x8d0
[c54a7020] [c00f8118] .update_process_times+0x48/0xa0
[c54a70b0] [c010cfe8] .tick_sched_timer+0x88/0xd0
[c54a7150] [c00f8b1c] .__run_hrtimer+0xcc/0x2c0
[c54a7200] [c00f9a98] .hrtimer_interrupt+0x158/0x330
[c54a7310] [c001a6b8] .__timer_interrupt+0xa8/0x280
[c54a73c0] [c001a920] .timer_interrupt+0x90/0x100
[c54a7440] [c0002260] decrementer_common+0x160/0x180
--- interrupt: 901 at .trace_buffer_lock_reserve+0x2c/0x90
LR = .trace_function+0x54/0xe0
[c54a77c0] [c01449cc] .function_trace_call+0x7c/0x120
[c54a7840] [c012d750] .ftrace_ops_no_ops+0xf0/0x170
[c54a78e0] [c0009d8c] ftrace_call+0x4/0x8
[c54a7950] [c072e128] .mutex_unlock+0x18/0x70
[c54a79d0] [c0137534] .tracing_buffers_splice_read+0x424/0x4c0
[c54a7c80] [c021bfe8] .do_splice_to+0xa8/0xe0
[c54a7d20] [c021eae4] .SyS_splice+0x694/0x6b0
[c54a7e30] [c0009224] syscall_exit+0x0/0x98


Note, the stress test is basically this:

perf record -o perf-test.dat -a -- trace-cmd record -e all -p function 
hackbench 2

It actually dies as it finishes the hackbench run and starts stopping
the tracing.

-- Steve
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 2/3] powerpc/ftrace: Remove mod_return_to_handler

2014-09-17 Thread Anton Blanchard
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 an...@samba.org
---
 arch/powerpc/kernel/entry_64.S | 24 +---
 arch/powerpc/kernel/ftrace.c   | 14 ++
 arch/powerpc/kernel/process.c  |  9 +
 3 files changed, 4 insertions(+), 43 deletions(-)

diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 5bbd1bc..955d509 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -1235,28 +1235,6 @@ _GLOBAL(ftrace_graph_caller)
 
 _GLOBAL(return_to_handler)
/* need to save return values */
-   std r4,  -24(r1)
-   std r3,  -16(r1)
-   std r31, -8(r1)
-   mr  r31, r1
-   stdur1, -112(r1)
-
-   bl  ftrace_return_to_handler
-   nop
-
-   /* return value has real return address */
-   mtlrr3
-
-   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 */
std r4,  -32(r1)
std r3,  -24(r1)
/* save TOC */
@@ -1266,7 +1244,7 @@ _GLOBAL(mod_return_to_handler)
stdur1, -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.
 */
ld  r2, PACATOC(r13)
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 390311c..abf7921 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -510,10 +510,6 @@ int ftrace_disable_ftrace_graph_caller(void)
 }
 #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
  * in current thread info.
@@ -523,7 +519,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned 
long self_addr)
unsigned long old;
int faulted;
struct ftrace_graph_ent trace;
-   unsigned long return_hooker = (unsigned long)return_to_handler;
+   unsigned long return_hooker;
 
if (unlikely(ftrace_graph_is_dead()))
return;
@@ -531,13 +527,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned 
long self_addr)
if (unlikely(atomic_read(current-tracing_graph_pause)))
return;
 
-#ifdef CONFIG_PPC64
-   /* 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);
+   return_hooker = ppc_function_entry(return_to_handler);
 
/*
 * Protect against fault, even if it shouldn't
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index aa1df89..080c0b9 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1531,13 +1531,6 @@ void show_stack(struct task_struct *tsk, unsigned long 
*stack)
int curr_frame = current-curr_ret_stack;
extern void return_to_handler(void);
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
 
sp = (unsigned long) stack;
@@ -1562,7 +1555,7 @@ void show_stack(struct task_struct *tsk, unsigned long 
*stack)
if (!firstframe || ip != lr) {
printk([REG] [REG] %pS, sp, ip, (void *)ip);
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-   if ((ip == rth || ip == mrth)  curr_frame = 0) {
+   if ((ip == rth)  curr_frame = 0) {
printk( (%pS),
   (void 
*)current-ret_stack[curr_frame].ret);
curr_frame--;
-- 
1.9.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev