[ARM] 5218/1: arm: improved futex support
authorMikael Pettersson <mikpe@it.uu.se>
Wed, 20 Aug 2008 08:36:07 +0000 (09:36 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 1 Sep 2008 11:06:26 +0000 (12:06 +0100)
commite589ed23dd27b890900eb7514f0a9e297d1e02b5
treef7f97ea17983bfc41d85d86e94fb580267f991cc
parent3305a60795442a22fe8e9f5fb93a6f1f8dea6bb2
[ARM] 5218/1: arm: improved futex support

Linux/ARM currently doesn't support robust or PI futexes.
The problem is that the kernel wants to perform certain ops
(cmpxchg, set, add, or, andn, xor) atomically on user-space
addresses, and ARM's futex.h doesn't support that.

This patch adds that support, but only for uniprocessor machines.
For UP it's enough to disable preemption to ensure mutual exclusion
with other software agents (futexes don't need to care about other
hardware agents, fortunately).

This patch is based on one posted by Khem Raj on 2007-08-01
<http://marc.info/?l=linux-arm-kernel&m=118599407413016&w=2>.
(That patch is included in the -RT kernel patches.)
My changes since that version include:
* corrected implementation of FUTEX_OP_ANDN (must complement oparg)
* added missing memory clobber to futex_atomic_cmpxchg_inatomic()
* removed spinlock because it's unnecessary for UP and insufficient
  for SMP, instead the code is restricted to UP and relies on the
  fact that pagefault_disable() also disables preemption
* coding style cleanups

Tested on ARMv5 XScales with the glibc-2.6 nptl test suite.

Tested-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/futex.h