Commit 93b24206 authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] OOPS instance counters

Patch from "Randy.Dunlap" <rddunlap@osdl.org>

Adds an oops counter to the oops messages, such as:

	Oops: 0002 [#2]

So we can tell whether oops reports refer to the first oops, or to some
less-interesting followon oops.
parent 9c58c3bd
......@@ -208,12 +208,13 @@ spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
{
struct task_struct *tsk = current;
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
printk("Internal error: %s: %x\n", str, err);
printk("Internal error: %s: %x [#%d]\n", str, err, ++die_counter);
print_modules();
printk("CPU: %d\n", smp_processor_id());
show_regs(regs);
......
......@@ -247,11 +247,13 @@ spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
void die(const char * str, struct pt_regs * regs, long err)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
handle_BUG(regs);
printk("%s: %04lx\n", str, err & 0xffff);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_registers(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
......
......@@ -101,6 +101,7 @@ die (const char *str, struct pt_regs *regs, long err)
.lock_owner = -1,
.lock_owner_depth = 0
};
static int die_counter;
if (die.lock_owner != smp_processor_id()) {
console_verbose();
......@@ -111,7 +112,8 @@ die (const char *str, struct pt_regs *regs, long err)
}
if (++die.lock_owner_depth < 3) {
printk("%s[%d]: %s %ld\n", current->comm, current->pid, str, err);
printk("%s[%d]: %s %ld [%d]\n",
current->comm, current->pid, str, err, ++die_counter);
show_regs(regs);
} else
printk(KERN_ERR "Recursive die() failure, output suppressed\n");
......
......@@ -191,12 +191,13 @@ spinlock_t die_lock;
extern void __die(const char * str, struct pt_regs * regs, const char *where,
unsigned long line)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
printk("%s", str);
if (where)
printk(" in %s, line %ld", where, line);
printk(":\n");
printk("[#%d]:\n", ++die_counter);
show_regs(regs);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long) current);
......
......@@ -161,12 +161,13 @@ spinlock_t die_lock;
void die(const char * str, struct pt_regs * regs, unsigned long err)
{
static int die_counter;
if (user_mode(regs)) /* Just return if in user mode. */
return;
console_verbose();
spin_lock_irq(&die_lock);
printk("%s: %04lx\n", str, err & 0xffff);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long) current);
......
......@@ -86,13 +86,14 @@ spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
void die(const char * str, struct pt_regs * fp, long err)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
#ifdef CONFIG_PMAC_BACKLIGHT
set_backlight_enable(1);
set_backlight_level(BACKLIGHT_MAX);
#endif
printk("Oops: %s, sig: %ld\n", str, err);
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
show_regs(fp);
spin_unlock_irq(&die_lock);
/* do_exit() should take care of panic'ing from an interrupt
......
......@@ -62,10 +62,11 @@ static spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
void die(const char *str, struct pt_regs *regs, long err)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
printk("Oops: %s, sig: %ld\n", str, err);
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
......
......@@ -226,10 +226,11 @@ spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
void die(const char * str, struct pt_regs * regs, long err)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
printk("%s: %04lx\n", str, err & 0xffff);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
......
......@@ -228,10 +228,11 @@ spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
void die(const char * str, struct pt_regs * regs, long err)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
printk("%s: %04lx\n", str, err & 0xffff);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
......
......@@ -58,9 +58,10 @@ spinlock_t die_lock;
void die(const char * str, struct pt_regs * regs, long err)
{
static int die_counter;
console_verbose();
spin_lock_irq(&die_lock);
printk("%s: %04lx\n", str, err & 0xffff);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
show_regs(regs);
spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
......
......@@ -325,11 +325,12 @@ void die(const char * str, struct pt_regs * regs, long err)
{
int cpu;
struct die_args args = { regs, str, err };
static int die_counter;
console_verbose();
notifier_call_chain(&die_chain, DIE_DIE, &args);
bust_spinlocks(1);
handle_BUG(regs);
printk("%s: %04lx\n", str, err & 0xffff);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
cpu = safe_smp_processor_id();
/* racy, but better than risking deadlock. */
local_irq_disable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment