[PATCH] spin_lock_irq debugging

Duncan Sands (baldrick@wanadoo.fr)
Wed, 21 May 2003 22:08:09 +0200


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/