aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-11-20 12:51:07 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-11-27 20:31:55 -0500
commitb1b35f2e218a5b57d03bbc3b0667d5064570dc60 (patch)
tree98c58046d2d058096a9fd8f2488b17bb102d19dc /kernel/trace/ftrace.c
parent7c6ea35ef50810aa12ab26f21cb858d980881576 (diff)
function_graph: Have profiler use curr_ret_stack and not depth
The profiler uses trace->depth to find its entry on the ret_stack, but the depth may not match the actual location of where its entry is (if an interrupt were to preempt the processing of the profiler for another function, the depth and the curr_ret_stack will be different). Have it use the curr_ret_stack as the index to find its ret_stack entry instead of using the depth variable, as that is no longer guaranteed to be the same. Cc: stable@kernel.org Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback") Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 48513954713c..77734451cb05 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -817,7 +817,7 @@ function_profile_call(unsigned long ip, unsigned long parent_ip,
817#ifdef CONFIG_FUNCTION_GRAPH_TRACER 817#ifdef CONFIG_FUNCTION_GRAPH_TRACER
818static int profile_graph_entry(struct ftrace_graph_ent *trace) 818static int profile_graph_entry(struct ftrace_graph_ent *trace)
819{ 819{
820 int index = trace->depth; 820 int index = current->curr_ret_stack;
821 821
822 function_profile_call(trace->func, 0, NULL, NULL); 822 function_profile_call(trace->func, 0, NULL, NULL);
823 823
@@ -852,7 +852,7 @@ static void profile_graph_return(struct ftrace_graph_ret *trace)
852 if (!fgraph_graph_time) { 852 if (!fgraph_graph_time) {
853 int index; 853 int index;
854 854
855 index = trace->depth; 855 index = current->curr_ret_stack;
856 856
857 /* Append this call time to the parent time to subtract */ 857 /* Append this call time to the parent time to subtract */
858 if (index) 858 if (index)