public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: anton@samba•org
To: linuxppc-dev@ozlabs•org
Cc: paulus@samba•org
Subject: [patch 03/10] Handle recursive oopses
Date: Tue, 20 Mar 2007 20:38:13 -0500	[thread overview]
Message-ID: <20070321013824.959599000@samba.org> (raw)
In-Reply-To: 20070321013810.404636000@samba.org

Handle recursive oopses, like on x86. We had a few cases recently where 
we locked up in oops printing and didnt make it into crashdump.

Signed-off-by: Anton Blanchard <anton@samba•org>
---

Index: linux-2.6/arch/powerpc/kernel/traps.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/traps.c	2007-03-11 10:34:44.000000000 -0500
+++ linux-2.6/arch/powerpc/kernel/traps.c	2007-03-11 11:03:11.000000000 -0500
@@ -108,42 +108,62 @@
 static inline void pmac_backlight_unblank(void) { }
 #endif
 
-static DEFINE_SPINLOCK(die_lock);
-
 int 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(die.lock),
+		.lock_owner =		-1,
+		.lock_owner_depth =	0
+	};
 	static int die_counter;
+	unsigned long flags;
 
 	if (debugger(regs))
 		return 1;
 
 	oops_enter();
 
-	console_verbose();
-	spin_lock_irq(&die_lock);
-	bust_spinlocks(1);
-	if (machine_is(powermac))
-		pmac_backlight_unblank();
+	if (die.lock_owner != raw_smp_processor_id()) {
+		console_verbose();
+		spin_lock_irqsave(&die.lock, flags);
+		die.lock_owner = smp_processor_id();
+		die.lock_owner_depth = 0;
+		bust_spinlocks(1);
+		if (machine_is(powermac))
+			pmac_backlight_unblank();
+	} else {
+		local_save_flags(flags);
+	}
 
-	printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
+	if (++die.lock_owner_depth < 3) {
+		printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
 #ifdef CONFIG_PREEMPT
-	printk("PREEMPT ");
+		printk("PREEMPT ");
 #endif
 #ifdef CONFIG_SMP
-	printk("SMP NR_CPUS=%d ", NR_CPUS);
+		printk("SMP NR_CPUS=%d ", NR_CPUS);
 #endif
 #ifdef CONFIG_DEBUG_PAGEALLOC
-	printk("DEBUG_PAGEALLOC ");
+		printk("DEBUG_PAGEALLOC ");
 #endif
 #ifdef CONFIG_NUMA
-	printk("NUMA ");
+		printk("NUMA ");
 #endif
-	printk("%s\n", ppc_md.name ? "" : ppc_md.name);
+		printk("%s\n", ppc_md.name ? "" : ppc_md.name);
+
+		print_modules();
+		show_regs(regs);
+	} else {
+		printk("Recursive die() failure, output suppressed\n");
+	}
 
-	print_modules();
-	show_regs(regs);
 	bust_spinlocks(0);
-	spin_unlock_irq(&die_lock);
+	die.lock_owner = -1;
+	spin_unlock_irqrestore(&die.lock, flags);
 
 	if (kexec_should_crash(current) ||
 		kexec_sr_activated(smp_processor_id()))

--

  parent reply	other threads:[~2007-03-21  1:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21  1:38 [patch 00/10] Oops path and debugger hooks rework anton
2007-03-21  1:38 ` [patch 01/10] Add missing oops_enter/oops_exit anton
2007-03-21  1:38 ` [patch 02/10] Clean up pmac_backlight_unblank in oops path anton
2007-03-21  1:38 ` anton [this message]
2007-03-21  1:38 ` [patch 04/10] Fix backwards ? : when printing machine type anton
2007-03-21  1:38 ` [patch 05/10] Use KERN_EMERG everywhere in oops printout anton
2007-03-21  2:23   ` Stephen Rothwell
2007-03-23 11:00   ` Paul Mackerras
2007-03-21  1:38 ` [patch 06/10] Add notify die hooks and remove some redundant debugger hooks anton
2007-03-21 16:14   ` Christoph Hellwig
2007-03-23 11:14   ` Paul Mackerras
2007-03-23 11:29     ` Christoph Hellwig
2007-03-23 12:04     ` Ananth N Mavinakayanahalli
2007-03-23 14:09     ` Anton Blanchard
2007-03-24  3:17       ` Paul Mackerras
2007-04-09 10:21       ` Paul Mackerras
2007-04-10  4:49         ` Ananth N Mavinakayanahalli
2007-03-21  1:38 ` [patch 07/10] Page fault handler should not depend on CONFIG_KPROBES anton
2007-03-21 16:13   ` Christoph Hellwig
2007-03-23 14:19     ` Anton Blanchard
2007-03-21  1:38 ` [patch 08/10] Use notifier hooks for xmon anton
2007-03-21  1:38 ` [patch 09/10] Use lowercase for hex printouts in oops messages anton
2007-03-21  2:14   ` Olof Johansson
2007-03-21  7:17     ` Geert Uytterhoeven
2007-03-21 16:44       ` Segher Boessenkool
2007-03-21  1:38 ` [patch 10/10] Make sure we only enable xmon once anton
2007-03-21  2:04   ` Anton Blanchard
2007-03-21  2:11   ` Olof Johansson
2007-03-21  2:05     ` Anton Blanchard

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=20070321013824.959599000@samba.org \
    --to=anton@samba$(echo .)org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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