aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2012-07-18 08:35:28 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-07-26 21:42:34 -0400
commitbac821a6e3404330d509fd3a245bf7701f210c7c (patch)
tree361463f5ee076563247aaba0dc8124a73fe67295 /arch/powerpc/kernel/ftrace.c
parente5ae3cdfd5741364e39705592b9aee9fb836f3d3 (diff)
powerpc/ftrace: Trace function graph entry before updating index
As Colin Cross ported my x86 change to ARM, he also pointed out that powerpc is also behind in this fix. The commit 722b3c746953 "ftrace/graph: Trace function entry before updating index" fixes an issue with function graph tracing for x86, where if the called entry function decides not to trace interrupts, it can fail the check if an interrupt comes in just after the curr_ret_stack is updated. The solution is to call the entry function first, then update the curr_ret_stack if the entry function wants to be traced. Cc: Colin Cross <ccross@android.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/ftrace.c')
-rw-r--r--arch/powerpc/kernel/ftrace.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 91b46b7f6f0d..1fb78561096a 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -630,18 +630,17 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
630 return; 630 return;
631 } 631 }
632 632
633 if (ftrace_push_return_trace(old, self_addr, &trace.depth, 0) == -EBUSY) {
634 *parent = old;
635 return;
636 }
637
638 trace.func = self_addr; 633 trace.func = self_addr;
634 trace.depth = current->curr_ret_stack + 1;
639 635
640 /* Only trace if the calling function expects to */ 636 /* Only trace if the calling function expects to */
641 if (!ftrace_graph_entry(&trace)) { 637 if (!ftrace_graph_entry(&trace)) {
642 current->curr_ret_stack--;
643 *parent = old; 638 *parent = old;
639 return;
644 } 640 }
641
642 if (ftrace_push_return_trace(old, self_addr, &trace.depth, 0) == -EBUSY)
643 *parent = old;
645} 644}
646#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 645#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
647 646