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.21/master created. glibc-2.21-35-ga68cafa


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.21/master has been created
        at  a68cafa11c500d8a49a3014c43c5152859d037ae (commit)

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

commit a68cafa11c500d8a49a3014c43c5152859d037ae
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 aadf824..4f035c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,25 @@
 
 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 a4a6ee1..ee52b0c 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -580,17 +580,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 881d098..ce75b3c 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -61,9 +61,8 @@ __pthread_cond_broadcast (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 ba32f40..0133ffe 100644
--- a/nptl/pthread_cond_signal.c
+++ b/nptl/pthread_cond_signal.c
@@ -47,11 +47,10 @@ __pthread_cond_signal (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 bf80467..3553b36 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 0d6558b..9db01d2 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 2bc1f88..3e4c06e 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;
@@ -73,7 +74,7 @@ __pthread_mutex_init (mutex, mutexattr)
       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=6e5cb616b5b442ce8b2664ad673c0acf42a490ac

commit 6e5cb616b5b442ce8b2664ad673c0acf42a490ac
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 3919fe9..aadf824 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,28 @@
 
 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 7f2043d..388c792 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -46,14 +46,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.  */
@@ -329,7 +323,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));
@@ -337,8 +331,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 84a7105..a4a6ee1 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 71a5619..e5087a9 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))
     lll_futex_wake (&pd->setxid_futex, 1, LLL_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;
@@ -418,7 +413,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 eb34bbc..2bc1f88 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -92,11 +92,9 @@ __pthread_mutex_init (mutex, mutexattr)
 
   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 7b4d9da..5de2b18 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 907d8af..63a2f0c 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -70,11 +70,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 3a44d59..10bc87e 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -31,5 +31,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 ca70d6d..813c246 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 6d74242..5b6582e 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=02b2a805268e2213cfbdc9bd50245a0a47724819

commit 02b2a805268e2213cfbdc9bd50245a0a47724819
Author: Roland McGrath <roland@hack.frob.com>
Date:   Fri May 22 10:18:17 2015 -0700

    Fix nptl-init.c use of INTERNAL_SYSCALL_DECL.

diff --git a/ChangeLog b/ChangeLog
index 423d715..3919fe9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-22  Roland McGrath  <roland@hack.frob.com>
+
+	* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
+	Use a separate INTERNAL_SYSCALL_DECL (err); in a local scope
+	for each INTERNAL_SYSCALL use.
+
 2016-06-03  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* nptl/pthread_mutex_init.c [__ASSUME_FUTEX_LOCK_PI]
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 1ad41c5..7f2043d 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -324,19 +324,22 @@ __pthread_initialize_minimal_internal (void)
 #endif
 
   /* Initialize the robust mutex data.  */
+  {
 #ifdef __PTHREAD_MUTEX_HAVE_PREV
-  pd->robust_prev = &pd->robust_head;
+    pd->robust_prev = &pd->robust_head;
 #endif
-  pd->robust_head.list = &pd->robust_head;
+    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));
-  int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
-			      sizeof (struct robust_list_head));
-  if (INTERNAL_SYSCALL_ERROR_P (res, err))
+    pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
+				    - offsetof (pthread_mutex_t,
+						__data.__list.__next));
+    INTERNAL_SYSCALL_DECL (err);
+    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_not_avail ();
+  }
 
 #ifdef __NR_futex
 # ifndef __ASSUME_PRIVATE_FUTEX
@@ -344,6 +347,7 @@ __pthread_initialize_minimal_internal (void)
      doing the test once this early is beneficial.  */
   {
     int word = 0;
+    INTERNAL_SYSCALL_DECL (err);
     word = INTERNAL_SYSCALL (futex, err, 3, &word,
 			    FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
     if (!INTERNAL_SYSCALL_ERROR_P (word, err))
@@ -364,6 +368,7 @@ __pthread_initialize_minimal_internal (void)
 	 is irrelevant.  Given that passing six parameters is difficult
 	 on some architectures we just pass whatever random value the
 	 calling convention calls for to the kernel.  It causes no harm.  */
+      INTERNAL_SYSCALL_DECL (err);
       word = INTERNAL_SYSCALL (futex, err, 5, &word,
 			       FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
 			       | FUTEX_PRIVATE_FLAG, 1, NULL, 0);
@@ -416,8 +421,11 @@ __pthread_initialize_minimal_internal (void)
 # ifdef SIGSETXID
   __sigaddset (&sa.sa_mask, SIGSETXID);
 # endif
-  (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
-			   NULL, _NSIG / 8);
+  {
+    INTERNAL_SYSCALL_DECL (err);
+    (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
+			     NULL, _NSIG / 8);
+  }
 #endif
 
   /* Get the size of the static and alignment requirements for the TLS

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

commit 9ac61c0047295696cbcdbc26bdc174c7bd25a3c8
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 666be70..423d715 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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-05-09  Yvan Roux  <yvan.roux@linaro.org>
 
 	* stdlib/setenv.c (unsetenv): Fix ambiguous 'else'.
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index d71cfef..eb34bbc 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 cb407db..7b4d9da 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 2ca6f10..907d8af 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -75,10 +75,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 ae1a11f..3a44d59 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -30,7 +30,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 50d9328..ca70d6d 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 94df407..6d74242 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]