]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
sh: ftrace: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 7 Dec 2018 18:06:04 +0000 (13:06 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 22 Dec 2018 13:21:02 +0000 (08:21 -0500)
The structure of the ret_stack array on the task struct is going to
change, and accessing it directly via the curr_ret_stack index will no
longer give the ret_stack entry that holds the return address. To access
that, architectures must now use ftrace_graph_get_ret_stack() to get the
associated ret_stack that matches the saved return address.

Cc: linux-sh@vger.kernel.org
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
arch/sh/kernel/dumpstack.c
arch/sh/kernel/dwarf.c

index b564b1eae4aee6d508a0c8696b80b4aa529d8af6..2c2e151bf39ec191bf7995876308f75e8f9fb4a2 100644 (file)
@@ -59,17 +59,20 @@ print_ftrace_graph_addr(unsigned long addr, void *data,
                        struct thread_info *tinfo, int *graph)
 {
        struct task_struct *task = tinfo->task;
+       struct ftrace_ret_stack *ret_stack;
        unsigned long ret_addr;
-       int index = task->curr_ret_stack;
 
        if (addr != (unsigned long)return_to_handler)
                return;
 
-       if (!task->ret_stack || index < *graph)
+       if (!task->ret_stack)
                return;
 
-       index -= *graph;
-       ret_addr = task->ret_stack[index].ret;
+       ret_stack = ftrace_graph_get_ret_stack(task, *graph);
+       if (!ret_stack)
+               return;
+
+       ret_addr = ret_stack->ret;
 
        ops->address(data, ret_addr, 1);
 
index bb511e2d9d68131c65e68b400ef662527069a751..df0fd6efe758bce3752e130d01c8a45747bdd5be 100644 (file)
@@ -608,17 +608,18 @@ struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
         * expected to find the real return address.
         */
        if (pc == (unsigned long)&return_to_handler) {
-               int index = current->curr_ret_stack;
+               struct ftrace_ret_stack *ret_stack;
 
+               ret_stack = ftrace_graph_get_ret_stack(current, 0);
+               if (ret_stack)
+                       pc = ret_stack->ret;
                /*
                 * We currently have no way of tracking how many
                 * return_to_handler()'s we've seen. If there is more
                 * than one patched return address on our stack,
                 * complain loudly.
                 */
-               WARN_ON(index > 0);
-
-               pc = current->ret_stack[index].ret;
+               WARN_ON(ftrace_graph_get_ret_stack(current, 1);
        }
 #endif