i386, dumpstack: use x86_64's method to account die_nest_count

oops_begin/oops_end should always be used in pairs. On x86_64
oops_begin increments die_nest_count, and oops_end decrements
die_nest_count. Doing this makes oops_begin and oops_end equal
to the x86_64 versions.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Alexander van Heukelum 2008-10-22 12:00:12 +02:00 committed by Ingo Molnar
parent 10b14cb7eb
commit e4955cfd2f
1 changed files with 17 additions and 12 deletions

View File

@ -289,21 +289,24 @@ static unsigned int die_nest_count;
unsigned __kprobes long oops_begin(void) unsigned __kprobes long oops_begin(void)
{ {
int cpu;
unsigned long flags; unsigned long flags;
oops_enter(); oops_enter();
if (die_owner != raw_smp_processor_id()) { /* racy, but better than risking deadlock. */
console_verbose();
raw_local_irq_save(flags); raw_local_irq_save(flags);
cpu = smp_processor_id();
if (!__raw_spin_trylock(&die_lock)) {
if (cpu == die_owner)
/* nested oops. should stop eventually */;
else
__raw_spin_lock(&die_lock); __raw_spin_lock(&die_lock);
die_owner = smp_processor_id();
die_nest_count = 0;
bust_spinlocks(1);
} else {
raw_local_irq_save(flags);
} }
die_nest_count++; die_nest_count++;
die_owner = cpu;
console_verbose();
bust_spinlocks(1);
return flags; return flags;
} }
@ -315,13 +318,15 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
bust_spinlocks(0); bust_spinlocks(0);
die_owner = -1; die_owner = -1;
add_taint(TAINT_DIE); add_taint(TAINT_DIE);
die_nest_count--;
if (!die_nest_count)
/* Nest count reaches zero, release the lock. */
__raw_spin_unlock(&die_lock); __raw_spin_unlock(&die_lock);
raw_local_irq_restore(flags); raw_local_irq_restore(flags);
oops_exit(); oops_exit();
if (!signr) if (!signr)
return; return;
if (in_interrupt()) if (in_interrupt())
panic("Fatal exception in interrupt"); panic("Fatal exception in interrupt");
if (panic_on_oops) if (panic_on_oops)