Commit 58154c8c authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc: Give us time to get all oopses out before panicking

I've been seeing truncated output when people send system reset info
to me. We should see a backtrace for every CPU, but the panic() code
takes the box down before they all make it out to the console. The
panic code runs unlocked so we also see corrupted console output.

If we are going to panic, then delay 1 second before calling into the
panic code. Move oops_exit inside the die lock and put a newline
between oopses for clarity.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent faa8bf88
...@@ -158,6 +158,8 @@ int die(const char *str, struct pt_regs *regs, long err) ...@@ -158,6 +158,8 @@ int die(const char *str, struct pt_regs *regs, long err)
bust_spinlocks(0); bust_spinlocks(0);
die.lock_owner = -1; die.lock_owner = -1;
add_taint(TAINT_DIE); add_taint(TAINT_DIE);
oops_exit();
printk("\n");
raw_spin_unlock_irqrestore(&die.lock, flags); raw_spin_unlock_irqrestore(&die.lock, flags);
if (kexec_should_crash(current) || if (kexec_should_crash(current) ||
...@@ -165,13 +167,23 @@ int die(const char *str, struct pt_regs *regs, long err) ...@@ -165,13 +167,23 @@ int die(const char *str, struct pt_regs *regs, long err)
crash_kexec(regs); crash_kexec(regs);
crash_kexec_secondary(regs); crash_kexec_secondary(regs);
/*
* While our oops output is serialised by a spinlock, output
* from panic() called below can race and corrupt it. If we
* know we are going to panic, delay for 1 second so we have a
* chance to get clean backtraces from all CPUs that are oopsing.
*/
if (in_interrupt() || panic_on_oops || !current->pid ||
is_global_init(current)) {
mdelay(MSEC_PER_SEC);
}
if (in_interrupt()) if (in_interrupt())
panic("Fatal exception in interrupt"); panic("Fatal exception in interrupt");
if (panic_on_oops) if (panic_on_oops)
panic("Fatal exception"); panic("Fatal exception");
oops_exit();
do_exit(err); do_exit(err);
return 0; return 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