From: Steven Rostedt Date: Wed, 18 Jul 2012 12:35:28 +0000 (+0000) Subject: powerpc/ftrace: Trace function graph entry before updating index X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bac821a6e3404330d509fd3a245bf7701f210c7c;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Steven Rostedt Signed-off-by: Benjamin Herrenschmidt --- 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) return; } - if (ftrace_push_return_trace(old, self_addr, &trace.depth, 0) == -EBUSY) { - *parent = old; - return; - } - trace.func = self_addr; + trace.depth = current->curr_ret_stack + 1; /* Only trace if the calling function expects to */ if (!ftrace_graph_entry(&trace)) { - current->curr_ret_stack--; *parent = old; + return; } + + if (ftrace_push_return_trace(old, self_addr, &trace.depth, 0) == -EBUSY) + *parent = old; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */