lockmeter
[Top] [All Lists]

bug in _spin_lock_()?

To: lockmeter@xxxxxxxxxxx
Subject: bug in _spin_lock_()?
From: "Pat O'Rourke" <orourke@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 03 Apr 2000 16:42:03 -0400
Organization: MIssion Critical Linux
Sender: owner-lockmeter@xxxxxxxxxxx
I was attempting to get the lockmeter code running in 2.3.99-pre3 on a 2 cpu
alpha and was encountering difficulty starting the second cpu.  After some
debugging I noticed _spin_lock_() did not contain a barrier() call as does
the spin_unlock_wait() macro on alpha (as well as several other architectures:
e.g. sparc, ppc, sparc64, ia64).  The problems I was having went away when I
applied the following change to kernel/lockmeter.c:

--- /mnt/sbox/linux-2.3.99-pre3/kernel/lockmeter.c      Fri Mar 31 13:33:18 2000
+++ linux-2.3.99-lstat/kernel/lockmeter.c       Mon Apr  3 12:36:35 2000
@@ -211,7 +211,9 @@
             * the bus locks.
             */
            while (test_and_set_bit(0,lock_ptr)) {
-               while (test_bit(0,lock_ptr));
+               do {
+                   barrier();
+               } while (test_bit(0,lock_ptr));
            }
 
            lstat_update_time(lock_ptr, this_pc, LSTAT_ACT_SPIN,


-- 
Patrick O'Rourke
orourke@xxxxxxxxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>