]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nptl: Remove __ASSUME_PRIVATE_FUTEX
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 17 May 2018 11:24:24 +0000 (04:24 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 17 May 2018 11:25:10 +0000 (04:25 -0700)
Since __ASSUME_PRIVATE_FUTEX is always defined, this patch removes the
!__ASSUME_PRIVATE_FUTEX paths.

Tested with build-many-glibcs.py.

* nptl/allocatestack.c (allocate_stack): Remove the
!__ASSUME_PRIVATE_FUTEX paths.
* nptl/descr.h (header): Remove the !__ASSUME_PRIVATE_FUTEX path.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
Likewise.
* sysdeps/i386/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Removed.
* sysdeps/powerpc/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
* sysdeps/sh/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
* sysdeps/x86_64/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
* sysdeps/i386/nptl/tls.h: (tcbhead_t): Remve the
!__ASSUME_PRIVATE_FUTEX path.
* sysdeps/s390/nptl/tls.h (tcbhead_t): Likewise.
* sysdeps/sparc/nptl/tls.h (tcbhead_t): Likewise.
* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise.
* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Remove the
!__ASSUME_PRIVATE_FUTEX macros.
* sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_PRIVATE_FUTEX): Removed.

17 files changed:
ChangeLog
nptl/allocatestack.c
nptl/descr.h
nptl/nptl-init.c
sysdeps/i386/nptl/tcb-offsets.sym
sysdeps/i386/nptl/tls.h
sysdeps/powerpc/nptl/tcb-offsets.sym
sysdeps/s390/nptl/tls.h
sysdeps/sh/nptl/tcb-offsets.sym
sysdeps/sparc/nptl/tls.h
sysdeps/unix/sysv/linux/i386/lowlevellock.S
sysdeps/unix/sysv/linux/kernel-features.h
sysdeps/unix/sysv/linux/lowlevellock-futex.h
sysdeps/unix/sysv/linux/x86_64/cancellation.S
sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
sysdeps/x86_64/nptl/tcb-offsets.sym
sysdeps/x86_64/nptl/tls.h

index 0a21739ee950f97e6ed81d7b0a2686dbe3974819..fc31a45396ede6a6e09189a544810aa1da7054a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2018-05-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * nptl/allocatestack.c (allocate_stack): Remove the
+       !__ASSUME_PRIVATE_FUTEX paths.
+       * nptl/descr.h (header): Remove the !__ASSUME_PRIVATE_FUTEX path.
+       * nptl/nptl-init.c (__pthread_initialize_minimal_internal):
+       Likewise.
+       * sysdeps/i386/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Removed.
+       * sysdeps/powerpc/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
+       * sysdeps/sh/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
+       * sysdeps/x86_64/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
+       * sysdeps/i386/nptl/tls.h: (tcbhead_t): Remve the
+       !__ASSUME_PRIVATE_FUTEX path.
+       * sysdeps/s390/nptl/tls.h (tcbhead_t): Likewise.
+       * sysdeps/sparc/nptl/tls.h (tcbhead_t): Likewise.
+       * sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise.
+       * sysdeps/unix/sysv/linux/i386/lowlevellock.S: Remove the
+       !__ASSUME_PRIVATE_FUTEX macros.
+       * sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
+       * sysdeps/unix/sysv/linux/kernel-features.h
+       (__ASSUME_PRIVATE_FUTEX): Removed.
+
 2018-05-17  Joseph Myers  <joseph@codesourcery.com>
 
        * math/Makefile (libm-narrow-fns): Add div.
index b374f4794d0614ebc3af89edd857b798b7d9c6fd..9c10b993fd465552d042a98d9834b40686aba0f9 100644 (file)
@@ -486,12 +486,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
       __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
-#ifndef __ASSUME_PRIVATE_FUTEX
-      /* The thread must know when private futexes are supported.  */
-      pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
-                                               header.private_futex);
-#endif
-
 #ifdef NEED_DL_SYSINFO
       SETUP_THREAD_SYSINFO (pd);
 #endif
@@ -610,12 +604,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
          __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
-#ifndef __ASSUME_PRIVATE_FUTEX
-         /* The thread must know when private futexes are supported.  */
-         pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
-                                                   header.private_futex);
-#endif
-
 #ifdef NEED_DL_SYSINFO
          SETUP_THREAD_SYSINFO (pd);
 #endif
index 64ba29e1cb5056e29cea7770d772315983715b41..0a0abb4d5a6ec3e583105abdc058f893257e57e0 100644 (file)
@@ -145,9 +145,6 @@ struct pthread
         looks to cancel itself and is hence going to end anyway.  */
       int multiple_threads;
       int gscope_flag;
-# ifndef __ASSUME_PRIVATE_FUTEX
-      int private_futex;
-# endif
     } header;
 #endif
 
index 5a4b52419f1feaec95fe1424fbf99e7f1c34a5fc..1d3790f500241e146ffae714ba682b76d75e4fd9 100644 (file)
@@ -313,24 +313,6 @@ __pthread_initialize_minimal_internal (void)
   }
 
 #ifdef __NR_futex
-# ifndef __ASSUME_PRIVATE_FUTEX
-  /* Private futexes are always used (at least internally) so that
-     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))
-      THREAD_SETMEM (pd, header.private_futex, FUTEX_PRIVATE_FLAG);
-  }
-
-  /* Private futexes have been introduced earlier than the
-     FUTEX_CLOCK_REALTIME flag.  We don't have to run the test if we
-     know the former are not supported.  This also means we know the
-     kernel will return ENOSYS for unknown operations.  */
-  if (THREAD_GETMEM (pd, header.private_futex) != 0)
-# endif
 # ifndef __ASSUME_FUTEX_CLOCK_REALTIME
     {
       int word = 0;
index 695a810386370172ace4ae7b6172d0c42cd58381..7d7fe5e71c19f63d65d33e7a95c303c5ed9b3bf4 100644 (file)
@@ -12,6 +12,3 @@ CLEANUP                       offsetof (struct pthread, cleanup)
 CLEANUP_PREV           offsetof (struct _pthread_cleanup_buffer, __prev)
 MUTEX_FUTEX            offsetof (pthread_mutex_t, __data.__lock)
 POINTER_GUARD          offsetof (tcbhead_t, pointer_guard)
-#ifndef __ASSUME_PRIVATE_FUTEX
-PRIVATE_FUTEX          offsetof (tcbhead_t, private_futex)
-#endif
index 8ca092469269c7075401f104f37674775b7a3c0c..6c36e58e9c654d71f4d329b6813d5ece9efc2b43 100644 (file)
@@ -41,11 +41,7 @@ typedef struct
   uintptr_t stack_guard;
   uintptr_t pointer_guard;
   int gscope_flag;
-#ifndef __ASSUME_PRIVATE_FUTEX
-  int private_futex;
-#else
   int __glibc_reserved1;
-#endif
   /* Reservation of some values for the TM ABI.  */
   void *__private_tm[4];
   /* GCC split stack support.  */
index 7c9fd33562e9b1e002e605f4306e3be2100e3bbd..e5bb2b376d7263739877a59c68dc9357b0887147 100644 (file)
@@ -27,6 +27,3 @@ TCB_AT_PLATFORM                       (offsetof (tcbhead_t, at_platform) - TLS_TCB_OFFSET - sizeof(t
 PADDING                                (offsetof (tcbhead_t, padding) - TLS_TCB_OFFSET - sizeof(tcbhead_t))
 #endif
 TCB_HWCAP                      (offsetof (tcbhead_t, hwcap) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
-#ifndef __ASSUME_PRIVATE_FUTEX
-PRIVATE_FUTEX_OFFSET           thread_offsetof (header.private_futex)
-#endif
index 37692e96ed803f4aaa61448ef439945b8f46434d..220bdfffb3b88852b10b5e5afbd63fd6f15986fc 100644 (file)
@@ -39,11 +39,7 @@ typedef struct
   uintptr_t sysinfo;
   uintptr_t stack_guard;
   int gscope_flag;
-#ifndef __ASSUME_PRIVATE_FUTEX
-  int private_futex;
-#else
   int __glibc_reserved1;
-#endif
   /* GCC split stack support.  */
   void *__private_ss;
 } tcbhead_t;
index 4963e1506f2c23b3a157e6ad2c29e1142df31455..234207779dc6fa3bae068bae378c3ddd46fea96f 100644 (file)
@@ -10,6 +10,3 @@ MULTIPLE_THREADS_OFFSET       offsetof (struct pthread, header.multiple_threads)
 TLS_PRE_TCB_SIZE       sizeof (struct pthread)
 MUTEX_FUTEX            offsetof (pthread_mutex_t, __data.__lock)
 POINTER_GUARD          offsetof (tcbhead_t, pointer_guard)
-#ifndef __ASSUME_PRIVATE_FUTEX
-PRIVATE_FUTEX          offsetof (struct pthread, header.private_futex)
-#endif
index 8a547f138e8a391e5c116600abb4438cd7c4b0e2..2a79868ee248a3fa62d18424843a432dbe91e001 100644 (file)
@@ -45,9 +45,6 @@ typedef struct
 #if __WORDSIZE != 64
   int gscope_flag;
 #endif
-#ifndef __ASSUME_PRIVATE_FUTEX
-  int private_futex;
-#endif
 } tcbhead_t;
 
 #else /* __ASSEMBLER__ */
index 416b484170d53be483de507b57708642dba81fb1..feda390eeb1cf3c363efbb4bc3b36cfcf8206c28 100644 (file)
 
        .text
 
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define LOAD_PRIVATE_FUTEX_WAIT(reg) \
+#define LOAD_PRIVATE_FUTEX_WAIT(reg) \
        movl    $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
-# define LOAD_PRIVATE_FUTEX_WAKE(reg) \
+#define LOAD_PRIVATE_FUTEX_WAKE(reg) \
        movl    $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
-# define LOAD_FUTEX_WAIT(reg) \
+#define LOAD_FUTEX_WAIT(reg) \
        xorl    $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
-# define LOAD_FUTEX_WAIT_ABS(reg) \
+#define LOAD_FUTEX_WAIT_ABS(reg) \
        xorl    $(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME), reg
-# define LOAD_FUTEX_WAKE(reg) \
+#define LOAD_FUTEX_WAKE(reg) \
        xorl    $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
-#else
-# if FUTEX_WAIT == 0
-#  define LOAD_PRIVATE_FUTEX_WAIT(reg) \
-       movl    %gs:PRIVATE_FUTEX, reg
-# else
-#  define LOAD_PRIVATE_FUTEX_WAIT(reg) \
-       movl    %gs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT, reg
-# endif
-# define LOAD_PRIVATE_FUTEX_WAKE(reg) \
-       movl    %gs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAKE, reg
-# if FUTEX_WAIT == 0
-#  define LOAD_FUTEX_WAIT(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %gs:PRIVATE_FUTEX, reg
-# else
-#  define LOAD_FUTEX_WAIT(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %gs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT, reg
-# endif
-# define LOAD_FUTEX_WAIT_ABS(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %gs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, reg
-# define LOAD_FUTEX_WAKE(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %gs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAKE, reg
-#endif
 
        .globl  __lll_lock_wait_private
        .type   __lll_lock_wait_private,@function
index 2ef2916a52418a43e79121407027e151698645e4..b90ea30195e8e8227cfde04f85d0527557bbb947 100644 (file)
@@ -61,9 +61,6 @@
    configurations).  */
 #define __ASSUME_SET_ROBUST_LIST       1
 
-/* Support for private futexes was added in 2.6.22.  */
-#define __ASSUME_PRIVATE_FUTEX 1
-
 /* Support for various CLOEXEC and NONBLOCK flags was added in
    2.6.27.  */
 #define __ASSUME_IN_NONBLOCK   1
index 4eddadb052a42c440b78e19f208fb4f12b315af3..fc834ed16e15b831d388cc4519a64fbd9995a211 100644 (file)
 
 #if IS_IN (libc) || IS_IN (rtld)
 /* In libc.so or ld.so all futexes are private.  */
-# ifdef __ASSUME_PRIVATE_FUTEX
-#  define __lll_private_flag(fl, private)                      \
+# define __lll_private_flag(fl, private)                       \
   ({                                                           \
     /* Prevent warnings in callers of this macro.  */          \
     int __lll_private_flag_priv __attribute__ ((unused));      \
     __lll_private_flag_priv = (private);                       \
     ((fl) | FUTEX_PRIVATE_FLAG);                               \
   })
-# else
-#  define __lll_private_flag(fl, private) \
-  ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))
-# endif
 #else
-# ifdef __ASSUME_PRIVATE_FUTEX
-#  define __lll_private_flag(fl, private) \
+# define __lll_private_flag(fl, private) \
   (((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
-# else
-#  define __lll_private_flag(fl, private) \
-  (__builtin_constant_p (private)                                            \
-   ? ((private) == 0                                                         \
-      ? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))           \
-      : (fl))                                                                \
-   : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG)                               \
-             & THREAD_GETMEM (THREAD_SELF, header.private_futex))))
-# endif
 #endif
 
 #define lll_futex_syscall(nargs, futexp, op, ...)                       \
index f3fb19dec2e3be00208fa2e4a1c3e74effa5bdb6..53dbabd6d28e1475bb7380bc44fedbe24092c4f1 100644 (file)
 #endif
 
 
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define LOAD_PRIVATE_FUTEX_WAIT(reg) \
+#define LOAD_PRIVATE_FUTEX_WAIT(reg) \
        movl    $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
-#else
-# if FUTEX_WAIT == 0
-#  define LOAD_PRIVATE_FUTEX_WAIT(reg) \
-       movl    %fs:PRIVATE_FUTEX, reg
-# else
-#  define LOAD_PRIVATE_FUTEX_WAIT(reg) \
-       movl    %fs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT, reg
-# endif
-#endif
 
 /* It is crucial that the functions in this file don't modify registers
    other than %rax and %r11.  The syscall wrapper code depends on this
index 92561e1da0eb37c59e762c71c054d6dbde658c7e..71dd740202b1d6501a2ffd929aa99cbd99a019ef 100644 (file)
 
        .text
 
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define LOAD_PRIVATE_FUTEX_WAIT(reg) \
+#define LOAD_PRIVATE_FUTEX_WAIT(reg) \
        movl    $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
-# define LOAD_PRIVATE_FUTEX_WAKE(reg) \
+#define LOAD_PRIVATE_FUTEX_WAKE(reg) \
        movl    $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
-# define LOAD_FUTEX_WAIT(reg) \
+#define LOAD_FUTEX_WAIT(reg) \
        xorl    $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
-# define LOAD_FUTEX_WAIT_ABS(reg) \
+#define LOAD_FUTEX_WAIT_ABS(reg) \
        xorl    $(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME), reg
-# define LOAD_FUTEX_WAKE(reg) \
+#define LOAD_FUTEX_WAKE(reg) \
        xorl    $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
-#else
-# if FUTEX_WAIT == 0
-#  define LOAD_PRIVATE_FUTEX_WAIT(reg) \
-       movl    %fs:PRIVATE_FUTEX, reg
-# else
-#  define LOAD_PRIVATE_FUTEX_WAIT(reg) \
-       movl    %fs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT, reg
-# endif
-# define LOAD_PRIVATE_FUTEX_WAKE(reg) \
-       movl    %fs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAKE, reg
-# if FUTEX_WAIT == 0
-#  define LOAD_FUTEX_WAIT(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %fs:PRIVATE_FUTEX, reg
-# else
-#  define LOAD_FUTEX_WAIT(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %fs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT, reg
-# endif
-# define LOAD_FUTEX_WAIT_ABS(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %fs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, reg
-# define LOAD_FUTEX_WAKE(reg) \
-       xorl    $FUTEX_PRIVATE_FLAG, reg ; \
-       andl    %fs:PRIVATE_FUTEX, reg ; \
-       orl     $FUTEX_WAKE, reg
-#endif
 
 
        .globl  __lll_lock_wait_private
index 8a25c482cb09a86fc83a4ed5d0ab9a0ee493cb7f..be63404a1604dc1640e840619ec7eb70730f0728 100644 (file)
@@ -12,9 +12,6 @@ MUTEX_FUTEX           offsetof (pthread_mutex_t, __data.__lock)
 MULTIPLE_THREADS_OFFSET        offsetof (tcbhead_t, multiple_threads)
 POINTER_GUARD          offsetof (tcbhead_t, pointer_guard)
 VGETCPU_CACHE_OFFSET   offsetof (tcbhead_t, vgetcpu_cache)
-#ifndef __ASSUME_PRIVATE_FUTEX
-PRIVATE_FUTEX          offsetof (tcbhead_t, private_futex)
-#endif
 
 -- Not strictly offsets, but these values are also used in the TCB.
 TCB_CANCELSTATE_BITMASK         CANCELSTATE_BITMASK
index 059f9675a0c40cd29286929f207ac4f6fc0e3fff..6da1c04a985b8057aa6f479e9824078946f82328 100644 (file)
@@ -51,11 +51,7 @@ typedef struct
   uintptr_t stack_guard;
   uintptr_t pointer_guard;
   unsigned long int vgetcpu_cache[2];
-# ifndef __ASSUME_PRIVATE_FUTEX
-  int private_futex;
-# else
   int __glibc_reserved1;
-# endif
   int __glibc_unused1;
   /* Reservation of some values for the TM ABI.  */
   void *__private_tm[4];