From: Keith Owens <kaos@sgi.com>
To: linux-kernel@vger.kernel.org
Subject: [patch 2.6.8-rc1] Make i386 die() more resilient against recursive errors
Date: Mon, 12 Jul 2004 17:05:03 +1000 [thread overview]
Message-ID: <11093.1089615903@kao2.melbourne.sgi.com> (raw)
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.
Signed-off-by: Keith Owens <kaos@sgi.com>
Index: 2.6.8-rc1/arch/i386/kernel/traps.c
===================================================================
--- 2.6.8-rc1.orig/arch/i386/kernel/traps.c 2004-07-12 16:52:39.000000000 +1000
+++ 2.6.8-rc1/arch/i386/kernel/traps.c 2004-07-12 16:52:42.000000000 +1000
@@ -292,35 +292,52 @@ bug:
printk("Kernel BUG\n");
}
-spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
-
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;
- int nl = 0;
- console_verbose();
- spin_lock_irq(&die_lock);
- bust_spinlocks(1);
- handle_BUG(regs);
- printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
+ if (die.lock_owner != smp_processor_id()) {
+ console_verbose();
+ spin_lock_irq(&die.lock);
+ die.lock_owner = smp_processor_id();
+ die.lock_owner_depth = 0;
+ bust_spinlocks(1);
+ }
+
+ if (++die.lock_owner_depth < 3) {
+ int nl = 0;
+ handle_BUG(regs);
+ printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
#ifdef CONFIG_PREEMPT
- printk("PREEMPT ");
- nl = 1;
+ printk("PREEMPT ");
+ nl = 1;
#endif
#ifdef CONFIG_SMP
- printk("SMP ");
- nl = 1;
+ printk("SMP ");
+ nl = 1;
#endif
#ifdef CONFIG_DEBUG_PAGEALLOC
- printk("DEBUG_PAGEALLOC");
- nl = 1;
+ printk("DEBUG_PAGEALLOC");
+ nl = 1;
#endif
- if (nl)
- printk("\n");
- show_registers(regs);
+ if (nl)
+ printk("\n");
+ show_registers(regs);
+ } else
+ printk(KERN_ERR "Recursive die() failure, output suppressed\n");
+
bust_spinlocks(0);
- spin_unlock_irq(&die_lock);
+ die.lock_owner = -1;
+ spin_unlock_irq(&die.lock);
if (in_interrupt())
panic("Fatal exception in interrupt");
reply other threads:[~2004-07-12 7:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=11093.1089615903@kao2.melbourne.sgi.com \
--to=kaos@sgi.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.