Commit 876e7a38 authored by Mark Rutland's avatar Mark Rutland Committed by Catalin Marinas

arm64: traps: simplify die() and __die()

In arm64's die and __die routines we pass around a thread_info, and
subsequently use this to determine the relevant task_struct, and the end
of the thread's stack. Subsequent patches will decouple thread_info from
the stack, and this approach will no longer work.

To figure out the end of the stack, we can use the new generic
end_of_stack() helper. As we only call __die() from die(), and die()
always deals with the current task, we can remove the parameter and have
both acquire current directly, which also makes it clear that __die
can't be called for arbitrary tasks.
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Tested-by: default avatarLaura Abbott <labbott@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent a9ea0017
...@@ -228,10 +228,9 @@ void show_stack(struct task_struct *tsk, unsigned long *sp) ...@@ -228,10 +228,9 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
#endif #endif
#define S_SMP " SMP" #define S_SMP " SMP"
static int __die(const char *str, int err, struct thread_info *thread, static int __die(const char *str, int err, struct pt_regs *regs)
struct pt_regs *regs)
{ {
struct task_struct *tsk = thread->task; struct task_struct *tsk = current;
static int die_counter; static int die_counter;
int ret; int ret;
...@@ -246,7 +245,8 @@ static int __die(const char *str, int err, struct thread_info *thread, ...@@ -246,7 +245,8 @@ static int __die(const char *str, int err, struct thread_info *thread,
print_modules(); print_modules();
__show_regs(regs); __show_regs(regs);
pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n", pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n",
TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1); TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk),
end_of_stack(tsk));
if (!user_mode(regs)) { if (!user_mode(regs)) {
dump_mem(KERN_EMERG, "Stack: ", regs->sp, dump_mem(KERN_EMERG, "Stack: ", regs->sp,
...@@ -265,7 +265,6 @@ static DEFINE_RAW_SPINLOCK(die_lock); ...@@ -265,7 +265,6 @@ static DEFINE_RAW_SPINLOCK(die_lock);
*/ */
void die(const char *str, struct pt_regs *regs, int err) void die(const char *str, struct pt_regs *regs, int err)
{ {
struct thread_info *thread = current_thread_info();
int ret; int ret;
oops_enter(); oops_enter();
...@@ -273,9 +272,9 @@ void die(const char *str, struct pt_regs *regs, int err) ...@@ -273,9 +272,9 @@ void die(const char *str, struct pt_regs *regs, int err)
raw_spin_lock_irq(&die_lock); raw_spin_lock_irq(&die_lock);
console_verbose(); console_verbose();
bust_spinlocks(1); bust_spinlocks(1);
ret = __die(str, err, thread, regs); ret = __die(str, err, regs);
if (regs && kexec_should_crash(thread->task)) if (regs && kexec_should_crash(current))
crash_kexec(regs); crash_kexec(regs);
bust_spinlocks(0); bust_spinlocks(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment