Skip to contentSkip to conversation

2.5.70: add info to spinlock debugging

PATCH New Andreas Mohr 1 participant 1 message May 29, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

kernel/sched.c +6 -1
diff -urN linux-2.5.70.orig/kernel/sched.c linux-2.5.70/kernel/sched.c
@@ -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
Signature · 2 lines
Help prevent Information Technology Fascism! - before it's too late...
http://www.againsttcpa.com