function_graph: Have profiler use curr_ret_stack and not depth
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 20 Nov 2018 17:51:07 +0000 (12:51 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Dec 2018 18:32:10 +0000 (19:32 +0100)
commitaec14c812ba877d94837d78def1832822594598a
treeaf06e0ec50cf65ebfe88301c6a78b915a61bc946
parent392374326d2905e1c617fae703237be84ba09e4f
function_graph: Have profiler use curr_ret_stack and not depth

commit b1b35f2e218a5b57d03bbc3b0667d5064570dc60 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ftrace.c