[BZ,#20985] robust mutexes: Fix broken x86 assembly by removing it
Commit Message
On Thu, 2016-12-22 at 12:23 +0100, Torvald Riegel wrote:
> On Thu, 2016-12-22 at 12:06 +0100, Florian Weimer wrote:
> > On 12/22/2016 11:22 AM, Torvald Riegel wrote:
> > > (LLL_ROBUST_MUTEX_LOCK_MODIFIER): New.
> >
> > This needs to be documented in the code. It seems the code always
> > defines it as 0, so it's not clear to me why it makes sense to define it
> > at all (twice even).
>
> This should be defined differently when pthread_mutex_cond_lock.c
> includes the file; I just noticed that it doesn't do that.
>
> Is the patch OK besides that (ie, so after fixing that oversight and
> adding a suitable comment to the definition of
> LLL_ROBUST_MUTEX_LOCK_MODIFIER?).
In particular, with this change:
@@ -11,7 +11,9 @@
lll_cond_trylock ((mutex)->__data.__lock)
#define LLL_MUTEX_TRYLOCK_ELISION(mutex) LLL_MUTEX_TRYLOCK(mutex)
-#define LLL_ROBUST_MUTEX_LOCK_MODIFIER 0
+/* We need to assume that there are other threads blocked on the futex.
+ See __pthread_mutex_lock_full for further details. */
+#define LLL_ROBUST_MUTEX_LOCK_MODIFIER FUTEX_WAITERS
#define __pthread_mutex_lock internal_function __pthread_mutex_cond_lock
#define __pthread_mutex_lock_full __pthread_mutex_cond_lock_full
#define NO_INCR
@@ -36,6 +36,8 @@
#define lll_trylock_elision(a,t) lll_trylock(a)
#endif
+/* Some of the following definitions differ when pthread_mutex_cond_lock.c
+ includes this file. */
#ifndef LLL_MUTEX_LOCK
# define LLL_MUTEX_LOCK(mutex) \
lll_lock ((mutex)->__data.__lock, PTHREAD_MUTEX_PSHARED (mutex))