[parisc-linux] missing barrier in _raw_spin_lock?

Arnd Bergmann arnd at arndb.de
Fri Jan 23 08:09:56 MST 2004


We stumbled over a problem on s390 that can cause random memory corruption
under high load on SMP. It turned out to be a missing on :"memory" clobber
on the _raw_spin_lock primitive.

As far as I can see, the same problem is in the parisc spinlock definition
in linux-2.6.1, but none of the other architectures.

The code below demonstrates the problem. With the broken spinlock, the
compiler does not emit code for the second "if" or for the assignment.
Similar code can be found in mempool_free().

	Arnd <><

----
#include <linux/spinlock.h>

static int x;
static spinlock_t lock;

void test(void)
{
        if (x) {
                spin_lock(&lock);
                if (!x)
                        x = 0x1234;
                spin_unlock(&lock);
        }
}



More information about the parisc-linux mailing list