[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20110815.143710.1173702549295979935.davem@davemloft.net>
Date: Mon, 15 Aug 2011 14:37:10 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: mikpe@...uu.se
Cc: sparclinux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH,v2] sparc32: unbreak arch_write_unlock()
From: Mikael Pettersson <mikpe@...uu.se>
Date: Mon, 15 Aug 2011 22:11:50 +0200
> The sparc32 version of arch_write_unlock() is just a plain assignment.
> Unfortunately this allows the compiler to schedule side-effects in a
> protected region to occur after the HW-level unlock, which is broken.
> E.g., the following trivial test case gets miscompiled:
>
> #include <linux/spinlock.h>
> rwlock_t lock;
> int counter;
> void foo(void) { write_lock(&lock); ++counter; write_unlock(&lock); }
>
> Fixed by adding a compiler memory barrier to arch_write_unlock(). The
> sparc64 version combines the barrier and assignment into a single asm(),
> and implements the operation as a static inline, so that's what I did too.
>
> Compile-tested with sparc32_defconfig + CONFIG_SMP=y.
>
> Signed-off-by: Mikael Pettersson <mikpe@...uu.se>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists