arm64: unwind: remove sp from struct stackframe

The unwind code sets the sp member of struct stackframe to
'frame pointer + 0x10' unconditionally, without regard for whether
doing so produces a legal value. So let's simply remove it now that
we have stopped using it anyway.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
This commit is contained in:
Ard Biesheuvel 2017-07-23 09:05:38 +01:00 committed by Mark Rutland
parent 7326749801
commit 31e43ad3b7
7 changed files with 1 additions and 14 deletions

View File

@ -20,7 +20,6 @@ struct task_struct;
struct stackframe { struct stackframe {
unsigned long fp; unsigned long fp;
unsigned long sp;
unsigned long pc; unsigned long pc;
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
unsigned int graph; unsigned int graph;

View File

@ -162,7 +162,6 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
} }
frame.fp = regs->regs[29]; frame.fp = regs->regs[29];
frame.sp = regs->sp;
frame.pc = regs->pc; frame.pc = regs->pc;
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
frame.graph = current->curr_ret_stack; frame.graph = current->curr_ret_stack;

View File

@ -382,15 +382,12 @@ unsigned long get_wchan(struct task_struct *p)
return 0; return 0;
frame.fp = thread_saved_fp(p); frame.fp = thread_saved_fp(p);
frame.sp = thread_saved_sp(p);
frame.pc = thread_saved_pc(p); frame.pc = thread_saved_pc(p);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
frame.graph = p->curr_ret_stack; frame.graph = p->curr_ret_stack;
#endif #endif
do { do {
if (frame.sp < stack_page || if (unwind_frame(p, &frame))
frame.sp >= stack_page + THREAD_SIZE ||
unwind_frame(p, &frame))
goto out; goto out;
if (!in_sched_functions(frame.pc)) { if (!in_sched_functions(frame.pc)) {
ret = frame.pc; ret = frame.pc;

View File

@ -42,7 +42,6 @@ void *return_address(unsigned int level)
data.addr = NULL; data.addr = NULL;
frame.fp = (unsigned long)__builtin_frame_address(0); frame.fp = (unsigned long)__builtin_frame_address(0);
frame.sp = current_stack_pointer;
frame.pc = (unsigned long)return_address; /* dummy */ frame.pc = (unsigned long)return_address; /* dummy */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
frame.graph = current->curr_ret_stack; frame.graph = current->curr_ret_stack;

View File

@ -58,7 +58,6 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
!on_task_stack(tsk, fp)) !on_task_stack(tsk, fp))
return -EINVAL; return -EINVAL;
frame->sp = fp + 0x10;
frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp));
frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8));
@ -136,7 +135,6 @@ void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
data.no_sched_functions = 0; data.no_sched_functions = 0;
frame.fp = regs->regs[29]; frame.fp = regs->regs[29];
frame.sp = regs->sp;
frame.pc = regs->pc; frame.pc = regs->pc;
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
frame.graph = current->curr_ret_stack; frame.graph = current->curr_ret_stack;
@ -161,12 +159,10 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
if (tsk != current) { if (tsk != current) {
data.no_sched_functions = 1; data.no_sched_functions = 1;
frame.fp = thread_saved_fp(tsk); frame.fp = thread_saved_fp(tsk);
frame.sp = thread_saved_sp(tsk);
frame.pc = thread_saved_pc(tsk); frame.pc = thread_saved_pc(tsk);
} else { } else {
data.no_sched_functions = 0; data.no_sched_functions = 0;
frame.fp = (unsigned long)__builtin_frame_address(0); frame.fp = (unsigned long)__builtin_frame_address(0);
frame.sp = current_stack_pointer;
frame.pc = (unsigned long)save_stack_trace_tsk; frame.pc = (unsigned long)save_stack_trace_tsk;
} }
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER

View File

@ -50,7 +50,6 @@ unsigned long profile_pc(struct pt_regs *regs)
return regs->pc; return regs->pc;
frame.fp = regs->regs[29]; frame.fp = regs->regs[29];
frame.sp = regs->sp;
frame.pc = regs->pc; frame.pc = regs->pc;
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
frame.graph = -1; /* no task info */ frame.graph = -1; /* no task info */

View File

@ -155,14 +155,12 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
if (tsk == current) { if (tsk == current) {
frame.fp = (unsigned long)__builtin_frame_address(0); frame.fp = (unsigned long)__builtin_frame_address(0);
frame.sp = current_stack_pointer;
frame.pc = (unsigned long)dump_backtrace; frame.pc = (unsigned long)dump_backtrace;
} else { } else {
/* /*
* task blocked in __switch_to * task blocked in __switch_to
*/ */
frame.fp = thread_saved_fp(tsk); frame.fp = thread_saved_fp(tsk);
frame.sp = thread_saved_sp(tsk);
frame.pc = thread_saved_pc(tsk); frame.pc = thread_saved_pc(tsk);
} }
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER