Commit 2fa69d93 authored by Keith Owens's avatar Keith Owens Committed by Linus Torvalds

[PATCH] Make i386 die() more resilient against recursive errors

Make i386 die() more resilient against recursive errors, almost a cut
and paste of the ia64 die() routine.  Much of the patch is indentation
changes.

Mainly to make it easier to add crash, lcrash, kmsgdump or other RAS patches. 
They are invoked from die() and if they crash themselves, we have to avoid
recursive loops in die().
Signed-off-by: default avatarKeith Owens <kaos@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7f2b65bd
...@@ -292,16 +292,29 @@ static void handle_BUG(struct pt_regs *regs) ...@@ -292,16 +292,29 @@ static void handle_BUG(struct pt_regs *regs)
printk("Kernel BUG\n"); printk("Kernel BUG\n");
} }
spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
void die(const char * str, struct pt_regs * regs, long err) void die(const char * str, struct pt_regs * regs, long err)
{ {
static struct {
spinlock_t lock;
u32 lock_owner;
int lock_owner_depth;
} die = {
.lock = SPIN_LOCK_UNLOCKED,
.lock_owner = -1,
.lock_owner_depth = 0
};
static int die_counter; static int die_counter;
int nl = 0;
if (die.lock_owner != smp_processor_id()) {
console_verbose(); console_verbose();
spin_lock_irq(&die_lock); spin_lock_irq(&die.lock);
die.lock_owner = smp_processor_id();
die.lock_owner_depth = 0;
bust_spinlocks(1); bust_spinlocks(1);
}
if (++die.lock_owner_depth < 3) {
int nl = 0;
handle_BUG(regs); handle_BUG(regs);
printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
...@@ -319,8 +332,12 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -319,8 +332,12 @@ void die(const char * str, struct pt_regs * regs, long err)
if (nl) if (nl)
printk("\n"); printk("\n");
show_registers(regs); show_registers(regs);
} else
printk(KERN_ERR "Recursive die() failure, output suppressed\n");
bust_spinlocks(0); bust_spinlocks(0);
spin_unlock_irq(&die_lock); die.lock_owner = -1;
spin_unlock_irq(&die.lock);
if (in_interrupt()) if (in_interrupt())
panic("Fatal exception in interrupt"); panic("Fatal exception in interrupt");
......
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