diff options
author | Roland McGrath <roland@hack.frob.com> | 2014-07-10 10:57:57 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2014-07-10 10:57:57 -0700 |
commit | 887865fcfab05939dabec78f5ad358d0283602d3 (patch) | |
tree | 91b4182f7d892a8bb784c8ac9f9caba22117387e | |
parent | 585367266923156ac6fb789939a923641ba5aaf4 (diff) | |
download | glibc-887865fcfab05939dabec78f5ad358d0283602d3.tar.gz glibc-887865fcfab05939dabec78f5ad358d0283602d3.tar.xz glibc-887865fcfab05939dabec78f5ad358d0283602d3.zip |
Get rid of lll_robust_trylock.
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | nptl/pthread_mutex_trylock.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/lowlevellock.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/lowlevellock.h | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/lowlevellock.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/lowlevellock.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/lowlevellock.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/microblaze/lowlevellock.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/lowlevellock.h | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/lowlevellock.h | 17 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/lowlevellock.h | 15 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sh/lowlevellock.h | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/lowlevellock.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/tile/lowlevellock.h | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 8 |
17 files changed, 25 insertions, 139 deletions
diff --git a/ChangeLog b/ChangeLog index 16b86e3055..0bd02c4d09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2014-07-10 Roland McGrath <roland@hack.frob.com> + + * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): + Use atomic_compare_and_exchange_val_acq directly rather than + lll_robust_trylock. + * sysdeps/unix/sysv/linux/aarch64/lowlevellock.h + (__lll_robust_trylock, lll_robust_trylock): Removed. + * sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/arm/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/m68k/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/mips/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/tile/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise. + 2014-07-02 Florian Weimer <fweimer@redhat.com> * manual/locale.texi (Locale Names): New section documenting diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c index e46f22ca2c..0867b06533 100644 --- a/nptl/pthread_mutex_trylock.c +++ b/nptl/pthread_mutex_trylock.c @@ -72,7 +72,7 @@ __pthread_mutex_trylock (mutex) elision: if (lll_trylock_elision (mutex->__data.__lock, mutex->__data.__elision) != 0) - break; + break; /* Don't record the ownership. */ return 0; @@ -159,7 +159,8 @@ __pthread_mutex_trylock (mutex) } } - oldval = lll_robust_trylock (mutex->__data.__lock, id); + oldval = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock, + id, 0); if (oldval != 0 && (oldval & FUTEX_OWNER_DIED) == 0) { THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL); diff --git a/sysdeps/unix/sysv/linux/aarch64/lowlevellock.h b/sysdeps/unix/sysv/linux/aarch64/lowlevellock.h index 69a5f278eb..0e61f18bf9 100644 --- a/sysdeps/unix/sysv/linux/aarch64/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/aarch64/lowlevellock.h @@ -180,11 +180,6 @@ #define lll_cond_trylock(lock) \ atomic_compare_and_exchange_val_acq(&(lock), 2, 0) -#define __lll_robust_trylock(futex, id) \ - (atomic_compare_and_exchange_val_acq (futex, id, 0) != 0) -#define lll_robust_trylock(lock, id) \ - __lll_robust_trylock (&(lock), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/alpha/lowlevellock.h b/sysdeps/unix/sysv/linux/alpha/lowlevellock.h index 361bd342f1..584094f780 100644 --- a/sysdeps/unix/sysv/linux/alpha/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/alpha/lowlevellock.h @@ -187,14 +187,6 @@ __lll_cond_trylock(int *futex) #define lll_cond_trylock(lock) __lll_cond_trylock (&(lock)) -static inline int __attribute__((always_inline)) -__lll_robust_trylock(int *futex, int id) -{ - return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0; -} -#define lll_robust_trylock(lock, id) \ - __lll_robust_trylock (&(lock), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/arm/lowlevellock.h b/sysdeps/unix/sysv/linux/arm/lowlevellock.h index 5d19434cdc..58699718a1 100644 --- a/sysdeps/unix/sysv/linux/arm/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/arm/lowlevellock.h @@ -176,11 +176,6 @@ #define lll_cond_trylock(lock) \ atomic_compare_and_exchange_val_acq(&(lock), 2, 0) -#define __lll_robust_trylock(futex, id) \ - (atomic_compare_and_exchange_val_acq (futex, id, 0) != 0) -#define lll_robust_trylock(lock, id) \ - __lll_robust_trylock (&(lock), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h b/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h index bd16f77cf2..426984f08f 100644 --- a/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h @@ -195,15 +195,6 @@ typedef int lll_lock_t; static inline int __attribute__ ((always_inline)) -__lll_robust_trylock (int *futex, int id) -{ - return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0; -} -#define lll_robust_trylock(futex, id) \ - __lll_robust_trylock (&(futex), id) - -static inline int -__attribute__ ((always_inline)) __lll_cond_trylock (int *futex) { return atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0; diff --git a/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/sysdeps/unix/sysv/linux/i386/lowlevellock.h index 6903f92bd0..02ec8f7e7e 100644 --- a/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -188,15 +188,6 @@ : "memory"); \ ret; }) -#define lll_robust_trylock(futex, id) \ - ({ int ret; \ - __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (futex) \ - : "r" (id), "m" (futex), \ - "0" (LLL_LOCK_INITIALIZER) \ - : "memory"); \ - ret; }) - #define lll_cond_trylock(futex) \ ({ int ret; \ diff --git a/sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h b/sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h index 9d323955a5..845a1533d1 100644 --- a/sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/ia64/nptl/lowlevellock.h @@ -169,12 +169,6 @@ while (0) #define lll_trylock(futex) __lll_trylock (&(futex)) -#define __lll_robust_trylock(futex, id) \ - (atomic_compare_and_exchange_val_acq (futex, id, 0) != 0) -#define lll_robust_trylock(futex, id) \ - __lll_robust_trylock (&(futex), id) - - #define __lll_cond_trylock(futex) \ (atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0) #define lll_cond_trylock(futex) __lll_cond_trylock (&(futex)) diff --git a/sysdeps/unix/sysv/linux/m68k/lowlevellock.h b/sysdeps/unix/sysv/linux/m68k/lowlevellock.h index ba36d93090..5ab5218721 100644 --- a/sysdeps/unix/sysv/linux/m68k/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/m68k/lowlevellock.h @@ -177,9 +177,6 @@ #define lll_cond_trylock(lock) \ atomic_compare_and_exchange_val_acq (&(lock), 2, 0) -#define lll_robust_trylock(lock, id) \ - atomic_compare_and_exchange_val_acq (&(lock), id, 0) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/microblaze/lowlevellock.h b/sysdeps/unix/sysv/linux/microblaze/lowlevellock.h index 47e18061e1..0de3e892c3 100644 --- a/sysdeps/unix/sysv/linux/microblaze/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/microblaze/lowlevellock.h @@ -180,11 +180,6 @@ #define lll_cond_trylock(lock) \ atomic_compare_and_exchange_val_acq(&(lock), 2, 0) -#define __lll_robust_trylock(futex, id) \ - (atomic_compare_and_exchange_val_acq (futex, id, 0) != 0) -#define lll_robust_trylock(lock, id) \ - __lll_robust_trylock (&(lock), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/mips/lowlevellock.h b/sysdeps/unix/sysv/linux/mips/lowlevellock.h index 07467f3790..f984c08e44 100644 --- a/sysdeps/unix/sysv/linux/mips/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/mips/lowlevellock.h @@ -187,14 +187,6 @@ __lll_cond_trylock(int *futex) #define lll_cond_trylock(lock) __lll_cond_trylock (&(lock)) -static inline int __attribute__((always_inline)) -__lll_robust_trylock(int *futex, int id) -{ - return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0; -} -#define lll_robust_trylock(lock, id) \ - __lll_robust_trylock (&(lock), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h index ab92c3fc8f..4af4a8206c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h @@ -202,23 +202,6 @@ # endif #endif -/* Set *futex to ID if it is 0, atomically. Returns the old value */ -#define __lll_robust_trylock(futex, id) \ - ({ int __val; \ - __asm __volatile ("1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \ - " cmpwi 0,%0,0\n" \ - " bne 2f\n" \ - " stwcx. %3,0,%2\n" \ - " bne- 1b\n" \ - "2: " __lll_acq_instr \ - : "=&r" (__val), "=m" (*futex) \ - : "r" (futex), "r" (id), "m" (*futex) \ - : "cr0", "memory"); \ - __val; \ - }) - -#define lll_robust_trylock(lock, id) __lll_robust_trylock (&(lock), id) - /* Set *futex to 1 if it is 0, atomically. Returns the old value */ #define __lll_trylock(futex) __lll_robust_trylock (futex, 1) diff --git a/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/sysdeps/unix/sysv/linux/s390/lowlevellock.h index cabff30be9..0bc641124c 100644 --- a/sysdeps/unix/sysv/linux/s390/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/s390/lowlevellock.h @@ -210,21 +210,6 @@ __lll_cond_trylock (int *futex) #define lll_cond_trylock(futex) __lll_cond_trylock (&(futex)) -static inline int -__attribute__ ((always_inline)) -__lll_robust_trylock (int *futex, int id) -{ - unsigned int old; - - __asm __volatile ("cs %0,%3,%1" - : "=d" (old), "=Q" (*futex) - : "0" (0), "d" (id), "m" (*futex) : "cc", "memory" ); - return old != 0; -} -#define lll_robust_trylock(futex, id) \ - __lll_robust_trylock (&(futex), id) - - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/sysdeps/unix/sysv/linux/sh/lowlevellock.h index 438632d962..fe8374e233 100644 --- a/sysdeps/unix/sysv/linux/sh/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/sh/lowlevellock.h @@ -118,28 +118,6 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; : "r0", "r1", "r2", "t", "memory"); \ __result; }) -#define lll_robust_trylock(futex, id) \ - ({ unsigned char __result; \ - __asm __volatile ("\ - .align 2\n\ - mova 1f,r0\n\ - nop\n\ - mov r15,r1\n\ - mov #-8,r15\n\ - 0: mov.l @%1,r2\n\ - cmp/eq r2,%3\n\ - bf 1f\n\ - mov.l %2,@%1\n\ - 1: mov r1,r15\n\ - mov #-1,%0\n\ - negc %0,%0"\ - : "=r" (__result) \ - : "r" (&(futex)), \ - "r" (id), \ - "r" (LLL_LOCK_INITIALIZER) \ - : "r0", "r1", "r2", "t", "memory"); \ - __result; }) - #define lll_cond_trylock(futex) \ ({ unsigned char __result; \ __asm __volatile ("\ diff --git a/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/sysdeps/unix/sysv/linux/sparc/lowlevellock.h index d4ed7a9bd7..015af35d28 100644 --- a/sysdeps/unix/sysv/linux/sparc/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/sparc/lowlevellock.h @@ -203,15 +203,6 @@ __lll_cond_trylock (int *futex) } #define lll_cond_trylock(futex) __lll_cond_trylock (&(futex)) -static inline int -__attribute__ ((always_inline)) -__lll_robust_trylock (int *futex, int id) -{ - return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0; -} -#define lll_robust_trylock(futex, id) \ - __lll_robust_trylock (&(futex), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/tile/lowlevellock.h b/sysdeps/unix/sysv/linux/tile/lowlevellock.h index 46149f1cd4..09c1b3d7e7 100644 --- a/sysdeps/unix/sysv/linux/tile/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/tile/lowlevellock.h @@ -186,14 +186,6 @@ __lll_cond_trylock (int *futex) #define lll_cond_trylock(lock) __lll_cond_trylock (&(lock)) -static inline int __attribute__ ((always_inline)) -__lll_robust_trylock (int *futex, int id) -{ - return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0; -} -#define lll_robust_trylock(lock, id) \ - __lll_robust_trylock (&(lock), id) - extern void __lll_lock_wait_private (int *futex) attribute_hidden; extern void __lll_lock_wait (int *futex, int private) attribute_hidden; extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h index c13ca084df..c93c68e64f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -165,14 +165,6 @@ : "memory"); \ ret; }) -#define lll_robust_trylock(futex, id) \ - ({ int ret; \ - __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1" \ - : "=a" (ret), "=m" (futex) \ - : "r" (id), "m" (futex), "0" (LLL_LOCK_INITIALIZER) \ - : "memory"); \ - ret; }) - #define lll_cond_trylock(futex) \ ({ int ret; \ __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1" \ |