]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.7/nds32-function_graph-simplify-with-function_graph_enter.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.19.7 / nds32-function_graph-simplify-with-function_graph_enter.patch
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()
5
6 From: Steven Rostedt (VMware) <rostedt@goodmis.org>
7
8 commit d48ebb24866edea2c35be02a878f25bc65529370 upstream.
9
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().
13
14 Have nds32 use the new code, and remove the shadow stack management as well as
15 having to set up the trace structure.
16
17 This is needed to prepare for a fix of a design bug on how the curr_ret_stack
18 is used.
19
20 Cc: Greentime Hu <greentime@andestech.com>
21 Cc: stable@kernel.org
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>
26
27 ---
28 arch/nds32/kernel/ftrace.c | 18 ++----------------
29 1 file changed, 2 insertions(+), 16 deletions(-)
30
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)
35 {
36 unsigned long return_hooker = (unsigned long)&return_to_handler;
37 - struct ftrace_graph_ent trace;
38 unsigned long old;
39 - int err;
40
41 if (unlikely(atomic_read(&current->tracing_graph_pause)))
42 return;
43
44 old = *parent;
45
46 - trace.func = self_addr;
47 - trace.depth = current->curr_ret_stack + 1;
48 -
49 - /* Only trace if the calling function expects to */
50 - if (!ftrace_graph_entry(&trace))
51 - return;
52 -
53 - err = ftrace_push_return_trace(old, self_addr, &trace.depth,
54 - frame_pointer, NULL);
55 -
56 - if (err == -EBUSY)
57 - return;
58 -
59 - *parent = return_hooker;
60 + if (!function_graph_enter(old, self_addr, frame_pointer, NULL))
61 + *parent = return_hooker;
62 }
63
64 noinline void ftrace_graph_caller(void)