[PATCH 3/7] x86_64, dumpstack: move kexec_crash from __die to oops_end

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alexander van Heukelum
Date: Wednesday, October 22, 2008 - 3:00 am

oops_end is preceded by either a call to __die, or a conditional
call to crash_kexec. Move the conditional call to crash_kexec
from the end of __die to the start of oops_end and remove
the superfluous call to crash_kexec in die_nmi.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
---
 arch/x86/kernel/dumpstack_64.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index ffefea6..57ce11b 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -458,6 +458,9 @@ unsigned __kprobes long oops_begin(void)
 
 void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
 {
+	if (regs && kexec_should_crash(current))
+		crash_kexec(regs);
+
 	die_owner = -1;
 	bust_spinlocks(0);
 	die_nest_count--;
@@ -501,8 +504,6 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
 	printk(KERN_ALERT "RIP ");
 	printk_address(regs->ip, 1);
 	printk(" RSP <%016lx>\n", regs->sp);
-	if (kexec_should_crash(current))
-		crash_kexec(regs);
 	return 0;
 }
 
@@ -536,11 +537,9 @@ die_nmi(char *str, struct pt_regs *regs, int do_panic)
 	printk(" on CPU%d, ip %08lx, registers:\n",
 		smp_processor_id(), regs->ip);
 	show_registers(regs);
-	if (kexec_should_crash(current))
-		crash_kexec(regs);
+	oops_end(flags, regs, 0);
 	if (do_panic || panic_on_oops)
 		panic("Non maskable interrupt");
-	oops_end(flags, regs, 0);
 	nmi_exit();
 	local_irq_enable();
 	do_exit(SIGBUS);
-- 
1.5.4.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86, dumpstack: some more unification, Alexander van Heukelum, (Mon Oct 20, 8:07 am)
[PATCH] x86: make oops_begin and oops_end equal, Alexander van Heukelum, (Mon Oct 20, 8:08 am)
[PATCH] x86, dumpstack: make die and die_nmi equal, Alexander van Heukelum, (Mon Oct 20, 8:11 am)
Re: [PATCH] x86, dumpstack: some more unification, Neil Horman, (Mon Oct 20, 9:51 am)
Re: [PATCH] x86: make oops_begin and oops_end equal, Neil Horman, (Tue Oct 21, 7:45 am)
Re: [PATCH] x86, dumpstack: make die and die_nmi equal, Neil Horman, (Tue Oct 21, 7:59 am)
[PATCH 0/7] x86, dumpstack: unify oops_begin, oops_end, di ..., Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 1/7] i386, dumpstack: Move crash_kexec before bust_ ..., Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 2/7] x86, dumpstack: let signr=0 signal no do_exit, Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 3/7] x86_64, dumpstack: move kexec_crash from __die ..., Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 4/7] x86, dumpstack: always call oops_exit from oop ..., Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 5/7] i386, dumpstack: use x86_64's method to accoun ..., Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 6/7] i386, dumpstack: use oops_begin/oops_end in di ..., Alexander van Heukelum, (Wed Oct 22, 3:00 am)
[PATCH 7/7] i386, dumpstack: unify die(), Alexander van Heukelum, (Wed Oct 22, 3:00 am)
Re: [PATCH] x86: make oops_begin and oops_end equal, Alexander van Heukelum, (Wed Oct 22, 3:18 am)
Re: [PATCH] x86: make oops_begin and oops_end equal, Neil Horman, (Wed Oct 22, 3:45 am)
Re: [PATCH] x86: make oops_begin and oops_end equal, Ingo Molnar, (Wed Oct 22, 5:02 am)
Re: [PATCH 7/7] i386, dumpstack: unify die(), Neil Horman, (Wed Oct 22, 6:37 am)
Re: [PATCH] x86: make oops_begin and oops_end equal, Neil Horman, (Wed Oct 22, 12:19 pm)
Re: [PATCH] x86: make oops_begin and oops_end equal, Alexander van Heukelum, (Thu Oct 23, 2:22 am)