2003-05-29 12:20:21

by Andreas Mohr

[permalink] [raw]
Subject: [PATCH] 2.5.70: add info to spinlock debugging

Hi all,

- directly print out in_atomic() and irqs_disabled() values to ease debugging
- add comment from original patch submission in order to be able to actually
know what this is all about...

Not sure whether that's an absolutely brilliant idea, but I think it's
useful.

Patch against vanilla 2.5.70.

Andreas Mohr

diff -urN linux-2.5.70.orig/kernel/sched.c linux-2.5.70/kernel/sched.c
--- linux-2.5.70.orig/kernel/sched.c 2003-05-28 17:59:02.000000000 +0200
+++ linux-2.5.70/kernel/sched.c 2003-05-28 17:52:21.000000000 +0200
@@ -2512,6 +2512,11 @@
}

#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
+/*
+ * Detect sleep-inside-spinlock bugs. It prints out a whiny
+ * message and a stack backtrace if someone calls a function which might
+ * sleep from within an atomic region.
+ */
void __might_sleep(char *file, int line)
{
#if defined(in_atomic)
@@ -2522,7 +2527,7 @@
return;
prev_jiffy = jiffies;
printk(KERN_ERR "Debug: sleeping function called from illegal"
- " context at %s:%d\n", file, line);
+ " context at %s:%d (in_atomic %d, irq_disabled %d)\n", file, line, in_atomic(), irqs_disabled());
dump_stack();
}
#endif

--
Help prevent Information Technology Fascism! - before it's too late...
http://www.againsttcpa.com