mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* allow recursive die() on i386
@ 2004-07-28 12:35 Jeff Moyer
  2004-07-28 13:11 ` Keith Owens
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Moyer @ 2004-07-28 12:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

Hello,

This patch allows for a recursive die() on i386.  This closely resembles
what is done on x86_64, fwiw.

-Jeff

--- linux-2.6.7/arch/i386/kernel/traps.c.orig	2004-07-28 08:08:21.000000000 -0400
+++ linux-2.6.7/arch/i386/kernel/traps.c	2004-07-28 08:10:54.000000000 -0400
@@ -294,6 +294,7 @@ bug:
 }
 
 spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
+static int die_owner = -1;
 
 void die(const char * str, struct pt_regs * regs, long err)
 {
@@ -301,7 +302,13 @@ void die(const char * str, struct pt_reg
 	int nl = 0;
 
 	console_verbose();
-	spin_lock_irq(&die_lock);
+	local_irq_disable();
+	if (!spin_trylock(&die_lock)) {
+		if (smp_processor_id() != die_owner)
+			spin_lock(&die_lock);
+		/* allow recursive die to fall through */
+	}
+	die_owner = smp_processor_id();
 	bust_spinlocks(1);
 	handle_BUG(regs);
 	printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
@@ -321,6 +328,7 @@ void die(const char * str, struct pt_reg
 		printk("\n");
 	show_registers(regs);
 	bust_spinlocks(0);
+	die_owner = -1;
 	spin_unlock_irq(&die_lock);
 	if (in_interrupt())
 		panic("Fatal exception in interrupt");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-28 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 12:35 allow recursive die() on i386 Jeff Moyer
2004-07-28 13:11 ` Keith Owens
2004-07-28 13:30   ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®