linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / lib / spinlock_debug.c
index 34022dd..5cbcb80 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
-#include <linux/module.h>
-
-int nopanic;
-static int __init nopanic_setup(char *str)
-{
-       nopanic = 1;
-       return 1;
-}
-EXPORT_SYMBOL_GPL(nopanic);
-__setup("dontpanic", nopanic_setup);
-
 
 static void spin_bug(spinlock_t *lock, const char *msg)
 {
@@ -30,9 +19,9 @@ static void spin_bug(spinlock_t *lock, const char *msg)
        if (xchg(&print_once, 0)) {
                if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
                        owner = lock->owner;
-               printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d (%s)\n",
+               printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
                        msg, raw_smp_processor_id(),
-                      current->comm, current->pid, print_tainted());
+                       current->comm, current->pid);
                printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, "
                                ".owner_cpu: %d\n",
                        lock, lock->magic,
@@ -44,10 +33,7 @@ static void spin_bug(spinlock_t *lock, const char *msg)
                /*
                 * We cannot continue on SMP:
                 */
-               if (nopanic)
-                       printk("bad locking\n");
-               else
-                       panic("bad locking");
+//             panic("bad locking");
 #endif
        }
 }
@@ -88,14 +74,15 @@ static void __spin_lock_debug(spinlock_t *lock)
                for (i = 0; i < loops_per_jiffy * HZ; i++) {
                        if (__raw_spin_trylock(&lock->raw_lock))
                                return;
+                       __delay(1);
                }
                /* lockup suspected: */
                if (print_once) {
                        print_once = 0;
                        printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
-                                       "%s/%d, %p (%s)\n",
+                                       "%s/%d, %p\n",
                                raw_smp_processor_id(), current->comm,
-                               current->pid, lock, print_tainted());
+                               current->pid, lock);
                        dump_stack();
                }
        }
@@ -135,9 +122,9 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
        static long print_once = 1;
 
        if (xchg(&print_once, 0)) {
-               printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p (%s)\n",
+               printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n",
                        msg, raw_smp_processor_id(), current->comm,
-                       current->pid, lock, print_tainted());
+                       current->pid, lock);
                dump_stack();
 #ifdef CONFIG_SMP
                /*
@@ -150,6 +137,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
 
 #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg)
 
+#if 0          /* __write_lock_debug() can lock up - maybe this can too? */
 static void __read_lock_debug(rwlock_t *lock)
 {
        int print_once = 1;
@@ -159,24 +147,25 @@ static void __read_lock_debug(rwlock_t *lock)
                for (i = 0; i < loops_per_jiffy * HZ; i++) {
                        if (__raw_read_trylock(&lock->raw_lock))
                                return;
+                       __delay(1);
                }
                /* lockup suspected: */
                if (print_once) {
                        print_once = 0;
                        printk(KERN_EMERG "BUG: read-lock lockup on CPU#%d, "
-                                       "%s/%d, %p (%s)\n",
+                                       "%s/%d, %p\n",
                                raw_smp_processor_id(), current->comm,
-                               current->pid, lock, print_tainted());
+                               current->pid, lock);
                        dump_stack();
                }
        }
 }
+#endif
 
 void _raw_read_lock(rwlock_t *lock)
 {
        RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
-       if (unlikely(!__raw_read_trylock(&lock->raw_lock)))
-               __read_lock_debug(lock);
+       __raw_read_lock(&lock->raw_lock);
 }
 
 int _raw_read_trylock(rwlock_t *lock)
@@ -222,6 +211,7 @@ static inline void debug_write_unlock(rwlock_t *lock)
        lock->owner_cpu = -1;
 }
 
+#if 0          /* This can cause lockups */
 static void __write_lock_debug(rwlock_t *lock)
 {
        int print_once = 1;
@@ -231,24 +221,25 @@ static void __write_lock_debug(rwlock_t *lock)
                for (i = 0; i < loops_per_jiffy * HZ; i++) {
                        if (__raw_write_trylock(&lock->raw_lock))
                                return;
+                       __delay(1);
                }
                /* lockup suspected: */
                if (print_once) {
                        print_once = 0;
                        printk(KERN_EMERG "BUG: write-lock lockup on CPU#%d, "
-                                       "%s/%d, %p (%s)\n",
+                                       "%s/%d, %p\n",
                                raw_smp_processor_id(), current->comm,
-                               current->pid, lock, print_tainted());
+                               current->pid, lock);
                        dump_stack();
                }
        }
 }
+#endif
 
 void _raw_write_lock(rwlock_t *lock)
 {
        debug_write_lock_before(lock);
-       if (unlikely(!__raw_write_trylock(&lock->raw_lock)))
-               __write_lock_debug(lock);
+       __raw_write_lock(&lock->raw_lock);
        debug_write_lock_after(lock);
 }