Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33bc9be6 authored by Mark Rutland's avatar Mark Rutland Committed by Olav Haugan
Browse files

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.

Change-Id: Ia1a054760ac01a42207cdc933e6a0ada729ad1db
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>
Git-commit: 876e7a38e8788773aac768091aaa3b42e470c03b
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[ohaugan@codeaurora.org: Fix merge conflicts]
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
parent 67b88d79
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -228,10 +228,9 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
#endif
#define S_SMP " SMP"

static int __die(const char *str, int err, struct thread_info *thread,
		 struct pt_regs *regs)
static int __die(const char *str, int err, struct pt_regs *regs)
{
	struct task_struct *tsk = thread->task;
	struct task_struct *tsk = current;
	static int die_counter;
	int ret;

@@ -246,7 +245,8 @@ static int __die(const char *str, int err, struct thread_info *thread,
	print_modules();
	__show_regs(regs);
	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)) {
		dump_backtrace(regs, tsk);
@@ -311,7 +311,6 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int notify)
 */
void die(const char *str, struct pt_regs *regs, int err)
{
	struct thread_info *thread = current_thread_info();
	enum bug_trap_type bug_type = BUG_TRAP_TYPE_NONE;
	unsigned long flags = oops_begin();
	int ret;
@@ -321,7 +320,7 @@ void die(const char *str, struct pt_regs *regs, int err)
	if (bug_type != BUG_TRAP_TYPE_NONE && !strlen(str))
		str = "Oops - BUG";

	ret = __die(str, err, thread, regs);
	ret = __die(str, err, regs);

	oops_end(flags, regs, ret);
}