Commit bac821a6e3404330d509fd3a245bf7701f210c7c
Committed by
Benjamin Herrenschmidt
1 parent
e5ae3cdfd5
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 5 additions and 6 deletions Side-by-side Diff
arch/powerpc/kernel/ftrace.c
... | ... | @@ -630,18 +630,17 @@ |
630 | 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 | 633 | trace.func = self_addr; |
634 | + trace.depth = current->curr_ret_stack + 1; | |
639 | 635 | |
640 | 636 | /* Only trace if the calling function expects to */ |
641 | 637 | if (!ftrace_graph_entry(&trace)) { |
642 | - current->curr_ret_stack--; | |
643 | 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 | 645 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
647 | 646 |