sparc64: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack

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: sparclinux@vger.kernel.org
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (VMware) 2018-12-07 12:51:27 -05:00
parent 0fad8bfef7
commit 945626db09
3 changed files with 14 additions and 9 deletions

View File

@ -1767,9 +1767,11 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
perf_callchain_store(entry, pc); perf_callchain_store(entry, pc);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
if ((pc + 8UL) == (unsigned long) &return_to_handler) { if ((pc + 8UL) == (unsigned long) &return_to_handler) {
int index = current->curr_ret_stack; struct ftrace_ret_stack *ret_stack;
if (current->ret_stack && index >= graph) { ret_stack = ftrace_graph_get_ret_stack(current,
pc = current->ret_stack[index - graph].ret; graph);
if (ret_stack) {
pc = ret_stack->ret;
perf_callchain_store(entry, pc); perf_callchain_store(entry, pc);
graph++; graph++;
} }

View File

@ -57,9 +57,11 @@ static void __save_stack_trace(struct thread_info *tp,
trace->entries[trace->nr_entries++] = pc; trace->entries[trace->nr_entries++] = pc;
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
if ((pc + 8UL) == (unsigned long) &return_to_handler) { if ((pc + 8UL) == (unsigned long) &return_to_handler) {
int index = t->curr_ret_stack; struct ftrace_ret_stack *ret_stack;
if (t->ret_stack && index >= graph) { ret_stack = ftrace_graph_get_ret_stack(t,
pc = t->ret_stack[index - graph].ret; graph);
if (ret_stack) {
pc = ret_stack->ret;
if (trace->nr_entries < if (trace->nr_entries <
trace->max_entries) trace->max_entries)
trace->entries[trace->nr_entries++] = pc; trace->entries[trace->nr_entries++] = pc;

View File

@ -2502,9 +2502,10 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
printk(" [%016lx] %pS\n", pc, (void *) pc); printk(" [%016lx] %pS\n", pc, (void *) pc);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
if ((pc + 8UL) == (unsigned long) &return_to_handler) { if ((pc + 8UL) == (unsigned long) &return_to_handler) {
int index = tsk->curr_ret_stack; struct ftrace_ret_stack *ret_stack;
if (tsk->ret_stack && index >= graph) { ret_stack = ftrace_graph_get_ret_stack(tsk, graph);
pc = tsk->ret_stack[index - graph].ret; if (ret_stack) {
pc = ret_stack->ret;
printk(" [%016lx] %pS\n", pc, (void *) pc); printk(" [%016lx] %pS\n", pc, (void *) pc);
graph++; graph++;
} }