• Mikael Pettersson's avatar
    [ARM] 5218/1: arm: improved futex support · e589ed23
    Mikael Pettersson authored
    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: default avatarBruce Ashfield <bruce.ashfield@windriver.com>
    Signed-off-by: default avatarMikael Pettersson <mikpe@it.uu.se>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    e589ed23
futex.h 2.94 KB