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

* Re: allow recursive die() on i386
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Owens @ 2004-07-28 13:11 UTC (permalink / raw)
  To: jmoyer; +Cc: linux-kernel, akpm

On Wed, 28 Jul 2004 08:35:39 -0400, 
Jeff Moyer <jmoyer@redhat.com> wrote:
>This patch allows for a recursive die() on i386.  This closely resembles
>what is done on x86_64, fwiw.

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.8-rc2/2.6.8-rc2-mm1/broken-out/make-i386-die-more-resilient-against-recursive-errors.patch

does this and more, it also guards against too many recursive calls to
die.  The patch is already in Andrew's tree.


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

* Re: allow recursive die() on i386
  2004-07-28 13:11 ` Keith Owens
@ 2004-07-28 13:30   ` Arjan van de Ven
  0 siblings, 0 replies; 3+ messages in thread
From: Arjan van de Ven @ 2004-07-28 13:30 UTC (permalink / raw)
  To: Keith Owens; +Cc: jmoyer, linux-kernel, akpm

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

On Wed, 2004-07-28 at 15:11, Keith Owens wrote:
> On Wed, 28 Jul 2004 08:35:39 -0400, 
> Jeff Moyer <jmoyer@redhat.com> wrote:
> >This patch allows for a recursive die() on i386.  This closely resembles
> >what is done on x86_64, fwiw.
> 
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.8-rc2/2.6.8-rc2-mm1/broken-out/make-i386-die-more-resilient-against-recursive-errors.patch
> 
> does this and more, it also guards against too many recursive calls to
> die.  The patch is already in Andrew's tree.
+	static struct {
+		spinlock_t lock;
+		u32 lock_owner;
+		int lock_owner_depth;
+	} die = {
+		.lock =			SPIN_LOCK_UNLOCKED,
+		.lock_owner =		-1,
+		.lock_owner_depth =	0
+	};


humm... am I the only one who considers this a little bit ugly ???

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ 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®