Skip to contentSkip to conversation

spin_lock_irq debugging

PATCH New Duncan Sands 1 participant 1 message May 21, 2003 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spin_lock_irq debugging

Of course the real problem is the corresponding spin_unlock_irq enabling local irqs when they should have been left disabled, but this is easier to check for. Your logs will fill up.

include/linux/spinlock.h +4 -0
diff -Nru a/include/linux/spinlock.h b/include/linux/spinlock.h
@@ -261,6 +261,10 @@
 
 #define spin_lock_irq(lock) \
 do { \
+	if (unlikely(irqs_disabled())) { \
+		printk(KERN_ERR "bad: spin_lock_irq with irqs disabled!\n"); \
+		dump_stack(); \
+	} \
 	local_irq_disable(); \
 	preempt_disable(); \
 	_raw_spin_lock(lock); \