mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org
Subject: allow recursive die() on i386
Date: Wed, 28 Jul 2004 08:35:39 -0400	[thread overview]
Message-ID: <16647.40347.365356.770724@segfault.boston.redhat.com> (raw)

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");

             reply	other threads:[~2004-07-28 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-28 12:35 Jeff Moyer [this message]
2004-07-28 13:11 ` Keith Owens
2004-07-28 13:30   ` Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16647.40347.365356.770724@segfault.boston.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®