summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-14 19:01:40 -0700
committerPatrick Mochel <mochel@osdl.org>2003-05-14 19:01:40 -0700
commit427a5f53952c25bf901ee185debe322f35c59be1 (patch)
tree360ef21f31a3f59db4c7a8d2805a9821db67406b /include/linux
parent18916f568e7d0afc5bcfd6d17478499a337b3593 (diff)
[PATCH] Make debugging variant of spinlocks a bit more robust
From: Petr Vandrovec <vandrove@vc.cvut.cz> While I was trying to hunt down problem with spin_lock_irq in send_sig_info, I noticed that debugging spinlocks are a bit unusable. The problem is that these spinlocks first print warning, and then decrement babble. So if the lock is used by printk code (like runqueue lock was), we get nothing, just a lockup or a double fault... When we first decrement babble and then print the error message we can break this unfortunate situation and the error message (5 of the same...) appear on screen.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/spinlock.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index a16b041fee5b..e93dbee94d45 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -79,10 +79,10 @@ typedef struct {
do { \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
+ (x)->babble--; \
printk("%s:%d: spin_lock(%s:%p) already locked by %s/%d\n", \
__FILE__,__LINE__, (x)->module, \
(x), (x)->owner, (x)->oline); \
- (x)->babble--; \
} \
(x)->lock = 1; \
(x)->owner = __FILE__; \
@@ -95,10 +95,10 @@ typedef struct {
({ \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
+ (x)->babble--; \
printk("%s:%d: spin_is_locked(%s:%p) already locked by %s/%d\n", \
__FILE__,__LINE__, (x)->module, \
(x), (x)->owner, (x)->oline); \
- (x)->babble--; \
} \
0; \
})
@@ -109,10 +109,10 @@ typedef struct {
({ \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
+ (x)->babble--; \
printk("%s:%d: spin_trylock(%s:%p) already locked by %s/%d\n", \
__FILE__,__LINE__, (x)->module, \
(x), (x)->owner, (x)->oline); \
- (x)->babble--; \
} \
(x)->lock = 1; \
(x)->owner = __FILE__; \
@@ -124,10 +124,10 @@ typedef struct {
do { \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
+ (x)->babble--; \
printk("%s:%d: spin_unlock_wait(%s:%p) owned by %s/%d\n", \
__FILE__,__LINE__, (x)->module, (x), \
(x)->owner, (x)->oline); \
- (x)->babble--; \
}\
} while (0)
@@ -135,9 +135,9 @@ typedef struct {
do { \
CHECK_LOCK(x); \
if (!(x)->lock&&(x)->babble) { \
+ (x)->babble--; \
printk("%s:%d: spin_unlock(%s:%p) not locked\n", \
__FILE__,__LINE__, (x)->module, (x));\
- (x)->babble--; \
} \
(x)->lock = 0; \
} while (0)