1 From d48ebb24866edea2c35be02a878f25bc65529370 Mon Sep 17 00:00:00 2001
2 From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
3 Date: Sun, 18 Nov 2018 17:26:35 -0500
4 Subject: nds32: function_graph: Simplify with function_graph_enter()
6 From: Steven Rostedt (VMware) <rostedt@goodmis.org>
8 commit d48ebb24866edea2c35be02a878f25bc65529370 upstream.
10 The function_graph_enter() function does the work of calling the function
11 graph hook function and the management of the shadow stack, simplifying the
12 work done in the architecture dependent prepare_ftrace_return().
14 Have nds32 use the new code, and remove the shadow stack management as well as
15 having to set up the trace structure.
17 This is needed to prepare for a fix of a design bug on how the curr_ret_stack
20 Cc: Greentime Hu <greentime@andestech.com>
22 Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback")
23 Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
24 Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 arch/nds32/kernel/ftrace.c | 18 ++----------------
29 1 file changed, 2 insertions(+), 16 deletions(-)
31 --- a/arch/nds32/kernel/ftrace.c
32 +++ b/arch/nds32/kernel/ftrace.c
33 @@ -211,29 +211,15 @@ void prepare_ftrace_return(unsigned long
34 unsigned long frame_pointer)
36 unsigned long return_hooker = (unsigned long)&return_to_handler;
37 - struct ftrace_graph_ent trace;
41 if (unlikely(atomic_read(¤t->tracing_graph_pause)))
46 - trace.func = self_addr;
47 - trace.depth = current->curr_ret_stack + 1;
49 - /* Only trace if the calling function expects to */
50 - if (!ftrace_graph_entry(&trace))
53 - err = ftrace_push_return_trace(old, self_addr, &trace.depth,
54 - frame_pointer, NULL);
59 - *parent = return_hooker;
60 + if (!function_graph_enter(old, self_addr, frame_pointer, NULL))
61 + *parent = return_hooker;
64 noinline void ftrace_graph_caller(void)