2003-05-21 19:55:10

by Duncan Sands

[permalink] [raw]
Subject: [PATCH] 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.

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); \