[PATCH] spin_lock_irq debugging

From: Duncan Sands (baldrick@wanadoo.fr)
Date: Wed May 21 2003 - 15:08:09 EST


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.

diff -Nru a/include/linux/spinlock.h b/include/linux/spinlock.h
--- a/include/linux/spinlock.h Wed May 21 22:04:29 2003
+++ b/include/linux/spinlock.h Wed May 21 22:04:29 2003
@@ -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); \

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:46 EST