This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch linaro/2.23/master created. glibc-2.23-67-gbb43342


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, linaro/2.23/master has been created
        at  bb433427a5de00b74d308532c27dc18cc348e03f (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bb433427a5de00b74d308532c27dc18cc348e03f

commit bb433427a5de00b74d308532c27dc18cc348e03f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue May 17 10:16:39 2016 -0300

    Add runtime check for __ASSUME_REQUEUE_PI (BZ# 18463)
    
    This patch adds a runtime check for requeue priority futexes
    (FUTEX_{WAIT,CMP}_REQUEUE_PI) for configurations that do not define
    __ASSUME_REQUEUE_PI.
    
    It uses the same check uses for priority lock/unlock support, where
    issuing a futex operation with FUTEX_UNLOCK_PI returns if kernel has
    or not internal 'futex_cmpxchg_enabled' support (which is also used
    on requeue priority futexes operations).
    
    For architectures that already have __ASSUME_REQUEUE_PI the code
    flow does not change, 'use_requeue_pi' returns the previous chec
    logic.  Also, if 'futex_cmpxchg_enabled' is not supported by the
    kernel, the previous logic will be used (by issuing a default futex
    operation).
    
    Tested on ARM (v3.8 kernel) and x86_64.
    
    	* nptl/pthreadP.h (prio_inherit_missing): Change name to
    	__prio_inherit_missing.
    	(USE_REQUEUE_PI): Remove define.
    	(use_requeue_pi): New function.
    	* nptl/pthread_cond_broadcast.c [__ASSUME_REQUEUE_PI]
    	(__pthread_cond_broadcast): Remove ifdef.
    	(USE_REQUEUE_PI): Change to use_requeue_pi.
    	* nptl/pthread_cond_signal.c [__ASSUME_REQUEUE_PI]
    	(__pthread_cond_signal): Remove ifdef.
    	(USE_REQUEUE_PI): Change to use_requeue_pi.
    	* nptl/pthread_cond_timedwait.c [__ASSUME_REQUEUE_PI]
    	(__pthread_cond_timedwait): Remove ifdef.
    	(USE_REQUEUE_PI): Change to use_requeue_pi.
    	( nptl/pthread_cond_wait.c [__ASSUME_REQUEUE_PI]
    	(__pthread_cond_wait): Remove ifdef.
    	(USE_REQUEUE_PI): Change to use_requeue_pi.
    	* nptl/pthread_mutex_init.c (prio_inherit_missing): Remove 'static'
    	qualifier and change name to __prio_inherit_missing.

diff --git a/ChangeLog b/ChangeLog
index 9657658..c9b1c96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2016-06-03  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* nptl/pthreadP.h (prio_inherit_missing): Change name to
+	__prio_inherit_missing.
+	(USE_REQUEUE_PI): Remove define.
+	(use_requeue_pi): New function.
+	* nptl/pthread_cond_broadcast.c [__ASSUME_REQUEUE_PI]
+	(__pthread_cond_broadcast): Remove ifdef.
+	(USE_REQUEUE_PI): Change to use_requeue_pi.
+	* nptl/pthread_cond_signal.c [__ASSUME_REQUEUE_PI]
+	(__pthread_cond_signal): Remove ifdef.
+	(USE_REQUEUE_PI): Change to use_requeue_pi.
+	* nptl/pthread_cond_timedwait.c [__ASSUME_REQUEUE_PI]
+	(__pthread_cond_timedwait): Remove ifdef.
+	(USE_REQUEUE_PI): Change to use_requeue_pi.
+	( nptl/pthread_cond_wait.c [__ASSUME_REQUEUE_PI]
+	(__pthread_cond_wait): Remove ifdef.
+	(USE_REQUEUE_PI): Change to use_requeue_pi.
+	* nptl/pthread_mutex_init.c (prio_inherit_missing): Remove 'static'
+	qualifier and change name to __prio_inherit_missing.
+
 	* nptl/nptl-init.c [__ASSUME_SET_ROBUST_LIST]
 	(__set_robust_list_avail): Remove define.
 	[__NR_set_robust_list] (__pthread_initialize_minimal_internal):
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index d479a3e..2b73c29 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -585,17 +585,22 @@ extern void __wait_lookup_done (void) attribute_hidden;
 # define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name);
 #endif
 
+extern bool __prio_inherit_missing (void);
+
 /* Test if the mutex is suitable for the FUTEX_WAIT_REQUEUE_PI operation.  */
-#if (defined lll_futex_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
-# define USE_REQUEUE_PI(mut) \
-   ((mut) && (mut) != (void *) ~0l \
-    && (((mut)->__data.__kind \
-	 & (PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NORMAL_NP)) \
-	== PTHREAD_MUTEX_PRIO_INHERIT_NP))
-#else
-# define USE_REQUEUE_PI(mut) 0
+static inline bool
+use_requeue_pi (pthread_mutex_t *mut)
+{
+#ifndef __ASSUME_REQUEUE_PI
+  if (__prio_inherit_missing ())
+    return false;
 #endif
+  return (mut) &&
+    (mut) != (void *) ~0l &&
+    (((mut)->__data.__kind
+      & (PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NORMAL_NP)) ==
+     PTHREAD_MUTEX_PRIO_INHERIT_NP);
+}
 
 /* Returns 0 if POL is a valid scheduling policy.  */
 static inline int
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index 552fd42..ef81bcd 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -60,9 +60,8 @@ __pthread_cond_broadcast (pthread_cond_t *cond)
 	  || PTHREAD_MUTEX_PSHARED (mut) & PTHREAD_MUTEX_PSHARED_BIT)
 	goto wake_all;
 
-#if (defined lll_futex_cmp_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
-      if (USE_REQUEUE_PI (mut))
+#ifdef lll_futex_cmp_requeue_pi
+      if (use_requeue_pi (mut))
 	{
 	  if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
 					&mut->__data.__lock, futex_val,
diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
index b3a6d3d..9c8f883 100644
--- a/nptl/pthread_cond_signal.c
+++ b/nptl/pthread_cond_signal.c
@@ -46,11 +46,10 @@ __pthread_cond_signal (pthread_cond_t *cond)
       ++cond->__data.__wakeup_seq;
       ++cond->__data.__futex;
 
-#if (defined lll_futex_cmp_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_cmp_requeue_pi
       pthread_mutex_t *mut = cond->__data.__mutex;
 
-      if (USE_REQUEUE_PI (mut)
+      if (use_requeue_pi (mut)
 	/* This can only really fail with a ENOSYS, since nobody can modify
 	   futex while we have the cond_lock.  */
 	  && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,
diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c
index 711a51d..61a651c 100644
--- a/nptl/pthread_cond_timedwait.c
+++ b/nptl/pthread_cond_timedwait.c
@@ -63,8 +63,7 @@ __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
   int pshared = (cond->__data.__mutex == (void *) ~0l)
 		? LLL_SHARED : LLL_PRIVATE;
 
-#if (defined lll_futex_timed_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_timed_wait_requeue_pi
   int pi_flag = 0;
 #endif
 
@@ -161,8 +160,7 @@ __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
 
 /* REQUEUE_PI was implemented after FUTEX_CLOCK_REALTIME, so it is sufficient
    to check just the former.  */
-#if (defined lll_futex_timed_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_timed_wait_requeue_pi
       /* If pi_flag remained 1 then it means that we had the lock and the mutex
 	 but a spurious waker raced ahead of us.  Give back the mutex before
 	 going into wait again.  */
@@ -171,7 +169,7 @@ __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
 	  __pthread_mutex_cond_lock_adjust (mutex);
 	  __pthread_mutex_unlock_usercnt (mutex, 0);
 	}
-      pi_flag = USE_REQUEUE_PI (mutex);
+      pi_flag = use_requeue_pi (mutex);
 
       if (pi_flag)
 	{
@@ -250,8 +248,7 @@ __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
   __pthread_cleanup_pop (&buffer, 0);
 
   /* Get the mutex before returning.  */
-#if (defined lll_futex_timed_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_timed_wait_requeue_pi
   if (pi_flag)
     {
       __pthread_mutex_cond_lock_adjust (mutex);
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index 3f62acc..f79bf67 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -86,7 +86,7 @@ __condvar_cleanup (void *arg)
 
   /* Get the mutex before returning unless asynchronous cancellation
      is in effect.  We don't try to get the mutex if we already own it.  */
-  if (!(USE_REQUEUE_PI (cbuffer->mutex))
+  if (!(use_requeue_pi (cbuffer->mutex))
       || ((cbuffer->mutex->__data.__lock & FUTEX_TID_MASK)
 	  != THREAD_GETMEM (THREAD_SELF, tid)))
   {
@@ -106,8 +106,7 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
   int pshared = (cond->__data.__mutex == (void *) ~0l)
 		? LLL_SHARED : LLL_PRIVATE;
 
-#if (defined lll_futex_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_wait_requeue_pi
   int pi_flag = 0;
 #endif
 
@@ -160,8 +159,7 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
       /* Enable asynchronous cancellation.  Required by the standard.  */
       cbuffer.oldtype = __pthread_enable_asynccancel ();
 
-#if (defined lll_futex_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_wait_requeue_pi
       /* If pi_flag remained 1 then it means that we had the lock and the mutex
 	 but a spurious waker raced ahead of us.  Give back the mutex before
 	 going into wait again.  */
@@ -170,7 +168,7 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
 	  __pthread_mutex_cond_lock_adjust (mutex);
 	  __pthread_mutex_unlock_usercnt (mutex, 0);
 	}
-      pi_flag = USE_REQUEUE_PI (mutex);
+      pi_flag = use_requeue_pi (mutex);
 
       if (pi_flag)
 	{
@@ -221,8 +219,7 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
   __pthread_cleanup_pop (&buffer, 0);
 
   /* Get the mutex before returning.  Not needed for PI.  */
-#if (defined lll_futex_wait_requeue_pi \
-     && defined __ASSUME_REQUEUE_PI)
+#ifdef lll_futex_wait_requeue_pi
   if (pi_flag)
     {
       __pthread_mutex_cond_lock_adjust (mutex);
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index 6aef890..c37f623 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -33,8 +33,9 @@ static const struct pthread_mutexattr default_mutexattr =
   };
 
 
-static bool
-prio_inherit_missing (void)
+bool
+attribute_hidden
+__prio_inherit_missing (void)
 {
 #ifdef __NR_futex
   static int tpi_supported;
@@ -72,7 +73,7 @@ __pthread_mutex_init (pthread_mutex_t *mutex,
       break;
 
     case PTHREAD_PRIO_INHERIT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT:
-      if (__glibc_unlikely (prio_inherit_missing ()))
+      if (__glibc_unlikely (__prio_inherit_missing ()))
 	return ENOTSUP;
       break;
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3501fea6908a747e4c9835228b4baaf06bc8e66b

commit 3501fea6908a747e4c9835228b4baaf06bc8e66b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon May 16 19:01:10 2016 -0300

    Remove __ASSUME_SET_ROBUST_LIST
    
    This patch removes __ASSUME_SET_ROBUST_LIST usage and assumes that
    kernel will correctly return if it supports or not
    futex_atomic_cmpxchg_inatomic.
    
    On minimum supported kernel (v3.2 and v2.6.32 for x86) kernel has:
    
    2418 SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
    2419                 size_t, len)
    2420 {
    2421         if (!futex_cmpxchg_enabled)
    2422                 return -ENOSYS;
    
    The patch also adds the __set_robust_list_avail runtime check for all
    architectures, since for some the syscall may still return ENOSYS if
    futex_atomic_cmpxchg_inatomic is not supported (for instance ARM).
    
    Tested on armhf (with 3.8 kernel) and x86_64.
    
    	* nptl/nptl-init.c [__ASSUME_SET_ROBUST_LIST]
    	(__set_robust_list_avail): Remove define.
    	[__NR_set_robust_list] (__pthread_initialize_minimal_internal):
    	Likewise.
    	* nptl/pthreadP.h [__ASSUME_SET_ROBUST_LIST]
    	(__set_robust_list_avail): Likewise.
    	* nptl/pthread_create.c
    	[__NR_set_robust_list && !__ASSUME_SET_ROBUST_LIST]
    	(START_THREAD_DEFN): Likewise.
    	* nptl/pthread_mutex_init.c [!__ASSUME_SET_ROBUST_LIST]
    	(__pthread_mutex_init): Likewise.
    	* sysdeps/unix/sysv/linux/arm/kernel-features.h
    	(__ASSUME_SET_ROBUST_LIST): Likewise.
    	* sysdeps/unix/sysv/linux/kernel-features.h:
    	(__ASSUME_SET_ROBUST_LIST): Likewise.
    	* sysdeps/unix/sysv/linux/m68k/kernel-features.h:
    	(__ASSUME_SET_ROBUST_LIST): Likewise.
    	* sysdeps/unix/sysv/linux/mips/kernel-features.h:
    	(__ASSUME_SET_ROBUST_LIST): Likewise.
    	* sysdeps/unix/sysv/linux/sparc/kernel-features.h:
    	(__ASSUME_SET_ROBUST_LIST): Likewise.

diff --git a/ChangeLog b/ChangeLog
index feef0a6..9657658 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2016-06-03  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* nptl/nptl-init.c [__ASSUME_SET_ROBUST_LIST]
+	(__set_robust_list_avail): Remove define.
+	[__NR_set_robust_list] (__pthread_initialize_minimal_internal):
+	Likewise.
+	* nptl/pthreadP.h [__ASSUME_SET_ROBUST_LIST]
+	(__set_robust_list_avail): Likewise.
+	* nptl/pthread_create.c
+	[__NR_set_robust_list && !__ASSUME_SET_ROBUST_LIST]
+	(START_THREAD_DEFN): Likewise.
+	* nptl/pthread_mutex_init.c [!__ASSUME_SET_ROBUST_LIST]
+	(__pthread_mutex_init): Likewise.
+	* sysdeps/unix/sysv/linux/arm/kernel-features.h
+	(__ASSUME_SET_ROBUST_LIST): Likewise.
+	* sysdeps/unix/sysv/linux/kernel-features.h:
+	(__ASSUME_SET_ROBUST_LIST): Likewise.
+	* sysdeps/unix/sysv/linux/m68k/kernel-features.h:
+	(__ASSUME_SET_ROBUST_LIST): Likewise.
+	* sysdeps/unix/sysv/linux/mips/kernel-features.h:
+	(__ASSUME_SET_ROBUST_LIST): Likewise.
+	* sysdeps/unix/sysv/linux/sparc/kernel-features.h:
+	(__ASSUME_SET_ROBUST_LIST): Likewise.
+
 	* nptl/pthread_mutex_init.c [__ASSUME_FUTEX_LOCK_PI]
 	(prio_inherit_missing): Remove define.
 	* sysdeps/unix/sysv/linux/arm/kernel-features.h
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index bdbdfed..cad14c7 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -48,14 +48,8 @@ int *__libc_multiple_threads_ptr attribute_hidden;
 size_t __static_tls_size;
 size_t __static_tls_align_m1;
 
-#ifndef __ASSUME_SET_ROBUST_LIST
 /* Negative if we do not have the system call and we can use it.  */
 int __set_robust_list_avail;
-# define set_robust_list_not_avail() \
-  __set_robust_list_avail = -1
-#else
-# define set_robust_list_not_avail() do { } while (0)
-#endif
 
 #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
 /* Nonzero if we do not have FUTEX_CLOCK_REALTIME.  */
@@ -328,7 +322,7 @@ __pthread_initialize_minimal_internal (void)
     pd->robust_prev = &pd->robust_head;
 #endif
     pd->robust_head.list = &pd->robust_head;
-#ifdef __NR_set_robust_list
+
     pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
 				    - offsetof (pthread_mutex_t,
 						__data.__list.__next));
@@ -336,8 +330,7 @@ __pthread_initialize_minimal_internal (void)
     int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
 				sizeof (struct robust_list_head));
     if (INTERNAL_SYSCALL_ERROR_P (res, err))
-#endif
-      set_robust_list_not_avail ();
+      __set_robust_list_avail = -1;
   }
 
 #ifdef __NR_futex
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 4edc74b..d479a3e 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -199,10 +199,8 @@ hidden_proto (__pthread_keys)
 /* Number of threads running.  */
 extern unsigned int __nptl_nthreads attribute_hidden;
 
-#ifndef __ASSUME_SET_ROBUST_LIST
 /* Negative if we do not have the system call and we can use it.  */
 extern int __set_robust_list_avail attribute_hidden;
-#endif
 
 /* Thread Priority Protection.  */
 extern int __sched_fifo_min_prio attribute_hidden;
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 5216041..1859cee 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -271,10 +271,7 @@ START_THREAD_DEFN
   if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
     futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
 
-#ifdef __NR_set_robust_list
-# ifndef __ASSUME_SET_ROBUST_LIST
-  if (__set_robust_list_avail >= 0)
-# endif
+  if (__glibc_likely (__set_robust_list_avail >= 0))
     {
       INTERNAL_SYSCALL_DECL (err);
       /* This call should never fail because the initial call in init.c
@@ -282,7 +279,6 @@ START_THREAD_DEFN
       INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
 			sizeof (struct robust_list_head));
     }
-#endif
 
 #ifdef SIGCANCEL
   /* If the parent was running cancellation handlers while creating
@@ -388,7 +384,6 @@ START_THREAD_DEFN
      the breakpoint reports TD_THR_RUN state rather than TD_THR_ZOMBIE.  */
   atomic_bit_set (&pd->cancelhandling, EXITING_BIT);
 
-#ifndef __ASSUME_SET_ROBUST_LIST
   /* If this thread has any robust mutexes locked, handle them now.  */
 # ifdef __PTHREAD_MUTEX_HAVE_PREV
   void *robust = pd->robust_head.list;
@@ -419,7 +414,6 @@ START_THREAD_DEFN
 	}
       while (robust != (void *) &pd->robust_head);
     }
-#endif
 
   /* Mark the memory of the stack as usable to the kernel.  We free
      everything except for the space used for the TCB itself.  */
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index 6e5acb6..6aef890 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -91,11 +91,9 @@ __pthread_mutex_init (pthread_mutex_t *mutex,
 
   if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0)
     {
-#ifndef __ASSUME_SET_ROBUST_LIST
       if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0
 	  && __set_robust_list_avail < 0)
 	return ENOTSUP;
-#endif
 
       mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP;
     }
diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 2b85a40..5829583 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -39,5 +39,4 @@
    configuration.  */
 #if __LINUX_KERNEL_VERSION < 0x030E03
 # undef __ASSUME_REQUEUE_PI
-# undef __ASSUME_SET_ROBUST_LIST
 #endif
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 63a6e11..102addf 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -64,11 +64,6 @@
    they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1.  */
 #define __ASSUME_ATFCTS	1
 
-/* Support for inter-process robust mutexes was added in 2.6.17 (but
-   some architectures lack futex_atomic_cmpxchg_inatomic in some
-   configurations).  */
-#define __ASSUME_SET_ROBUST_LIST	1
-
 /* Support for private futexes was added in 2.6.22.  */
 #define __ASSUME_PRIVATE_FUTEX	1
 
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 9bde49c..27c5efe 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -55,5 +55,4 @@
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
 #if __LINUX_KERNEL_VERSION < 0x030a00
 # undef __ASSUME_REQUEUE_PI
-# undef __ASSUME_SET_ROBUST_LIST
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index e84e84c..f236208 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -44,5 +44,4 @@
    emulating LL/SC.  */
 #if __mips == 1 || defined _MIPS_ARCH_R5900
 # undef __ASSUME_REQUEUE_PI
-# undef __ASSUME_SET_ROBUST_LIST
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 2469159..0b5efd7 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -42,5 +42,4 @@
    futex_atomic_cmpxchg_inatomic.  */
 #if !defined __arch64__ && !defined __sparc_v9__
 # undef __ASSUME_REQUEUE_PI
-# undef __ASSUME_SET_ROBUST_LIST
 #endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bab150583d44c1b1696c653412a2791259a8bb4b

commit bab150583d44c1b1696c653412a2791259a8bb4b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon May 16 10:35:25 2016 -0300

    Remove __ASSUME_FUTEX_LOCK_PI
    
    This patch removes __ASSUME_FUTEX_LOCK_PI usage and assumes that
    kernel will correctly return if it supports or not
    futex_atomic_cmpxchg_inatomic.
    
    Current PI mutex code already has runtime support by calling
    prio_inherit_missing and returns ENOTSUP if the futex operation fails
    at initialization (it issues a FUTEX_UNLOCK_PI futex operation).
    
    Also, current minimum supported kernel (v3.2) will return ENOSYS if
    futex_atomic_cmpxchg_inatomic is not supported in the system:
    
    kernel/futex.c:
    
    2628 long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
    2629                 u32 __user *uaddr2, u32 val2, u32 val3)
    2630 {
    2631         int ret = -ENOSYS, cmd = op & FUTEX_CMD_MASK;
    [...]
    2667         case FUTEX_UNLOCK_PI:
    2668                 if (futex_cmpxchg_enabled)
    2669                         ret = futex_unlock_pi(uaddr, flags);
    [...]
    2686         return ret;
    2687 }
    
    The futex_cmpxchg_enabled is initialized by calling cmpxchg_futex_value_locked,
    which calls futex_atomic_cmpxchg_inatomic.
    
    For ARM futex_atomic_cmpxchg_inatomic will be either defined (if both
    CONFIG_CPU_USE_DOMAINS and CONFIG_SMP are not defined) or use the
    default generic implementation that returns ENOSYS.
    
    For m68k is uses the default generic implementation.
    
    For mips futex_atomic_cmpxchg_inatomic will return ENOSYS if cpu has no
    'cpu_has_llsc' support (defined by each chip supporte inside kernel).
    
    For sparc, 32-bit kernel will just use default generic implementation,
    while 64-bit kernel has support.
    
    Tested on ARM (v3.8 kernel) and x86_64.
    
    	* nptl/pthread_mutex_init.c [__ASSUME_FUTEX_LOCK_PI]
    	(prio_inherit_missing): Remove define.
    	* sysdeps/unix/sysv/linux/arm/kernel-features.h
    	(__ASSUME_FUTEX_LOCK_PI): Likewise.
    	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_FUTEX_LOCK_PI):
    	Likewise.
    	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
    	(__ASSUME_FUTEX_LOCK_PI): Likewise.
    	* sysdeps/unix/sysv/linux/mips/kernel-features.h
    	(__ASSUME_FUTEX_LOCK_PI): Likewise.
    	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
    	(__ASSUME_FUTEX_LOCK_PI): Likewise.

diff --git a/ChangeLog b/ChangeLog
index e6354b1..feef0a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2016-06-03  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* nptl/pthread_mutex_init.c [__ASSUME_FUTEX_LOCK_PI]
+	(prio_inherit_missing): Remove define.
+	* sysdeps/unix/sysv/linux/arm/kernel-features.h
+	(__ASSUME_FUTEX_LOCK_PI): Likewise.
+	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_FUTEX_LOCK_PI):
+	Likewise.
+	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
+	(__ASSUME_FUTEX_LOCK_PI): Likewise.
+	* sysdeps/unix/sysv/linux/mips/kernel-features.h
+	(__ASSUME_FUTEX_LOCK_PI): Likewise.
+	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
+	(__ASSUME_FUTEX_LOCK_PI): Likewise.
+
+2016-06-03  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
 	[BZ #20012]
 	* libio/fmemopen.c (fmemopen_read): Use buffer maximum position, not
 	length to calculate the buffer to read.
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index 71ac7bc..6e5acb6 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -37,7 +37,6 @@ static bool
 prio_inherit_missing (void)
 {
 #ifdef __NR_futex
-# ifndef __ASSUME_FUTEX_LOCK_PI
   static int tpi_supported;
   if (__glibc_unlikely (tpi_supported == 0))
     {
@@ -48,8 +47,6 @@ prio_inherit_missing (void)
       tpi_supported = INTERNAL_SYSCALL_ERRNO (ret, err) == ENOSYS ? -1 : 1;
     }
   return __glibc_unlikely (tpi_supported < 0);
-# endif
-  return false;
 #endif
   return true;
 }
diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 6f1606c..2b85a40 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -38,7 +38,6 @@
    futex_atomic_cmpxchg_inatomic, depending on kernel
    configuration.  */
 #if __LINUX_KERNEL_VERSION < 0x030E03
-# undef __ASSUME_FUTEX_LOCK_PI
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 9832f41..63a6e11 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -69,10 +69,6 @@
    configurations).  */
 #define __ASSUME_SET_ROBUST_LIST	1
 
-/* Support for PI futexes was added in 2.6.18 (but some architectures
-   lack futex_atomic_cmpxchg_inatomic in some configurations).  */
-#define __ASSUME_FUTEX_LOCK_PI	1
-
 /* Support for private futexes was added in 2.6.22.  */
 #define __ASSUME_PRIVATE_FUTEX	1
 
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 1b9fbc3..9bde49c 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -54,7 +54,6 @@
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
 #if __LINUX_KERNEL_VERSION < 0x030a00
-# undef __ASSUME_FUTEX_LOCK_PI
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index 83f7a47..e84e84c 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -43,7 +43,6 @@
 /* The MIPS kernel does not support futex_atomic_cmpxchg_inatomic if
    emulating LL/SC.  */
 #if __mips == 1 || defined _MIPS_ARCH_R5900
-# undef __ASSUME_FUTEX_LOCK_PI
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index abcef75..2469159 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -41,7 +41,6 @@
 /* 32-bit SPARC kernels do not support
    futex_atomic_cmpxchg_inatomic.  */
 #if !defined __arch64__ && !defined __sparc_v9__
-# undef __ASSUME_FUTEX_LOCK_PI
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
 #endif

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]