diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-05-17 04:24:24 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-05-17 04:25:10 -0700 |
commit | 0068c08588389c4586f0481455bb2af9b44cee4e (patch) | |
tree | 57be75b3ab9ae3a264465164a64d11bbb2655657 | |
parent | 632a6cbe44cdd41dba7242887992cdca7b42922a (diff) | |
download | glibc-0068c08588389c4586f0481455bb2af9b44cee4e.tar.gz |
nptl: Remove __ASSUME_PRIVATE_FUTEX
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.
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | nptl/allocatestack.c | 12 | ||||
-rw-r--r-- | nptl/descr.h | 3 | ||||
-rw-r--r-- | nptl/nptl-init.c | 18 | ||||
-rw-r--r-- | sysdeps/i386/nptl/tcb-offsets.sym | 3 | ||||
-rw-r--r-- | sysdeps/i386/nptl/tls.h | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/nptl/tcb-offsets.sym | 3 | ||||
-rw-r--r-- | sysdeps/s390/nptl/tls.h | 4 | ||||
-rw-r--r-- | sysdeps/sh/nptl/tcb-offsets.sym | 3 | ||||
-rw-r--r-- | sysdeps/sparc/nptl/tls.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/lowlevellock.S | 42 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/kernel-features.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/lowlevellock-futex.h | 19 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/cancellation.S | 13 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 42 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/tcb-offsets.sym | 3 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/tls.h | 4 |
17 files changed, 37 insertions, 166 deletions
@@ -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. diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index b374f4794d..9c10b993fd 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -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 diff --git a/nptl/descr.h b/nptl/descr.h index 64ba29e1cb..0a0abb4d5a 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -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 diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index 5a4b52419f..1d3790f500 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -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; diff --git a/sysdeps/i386/nptl/tcb-offsets.sym b/sysdeps/i386/nptl/tcb-offsets.sym index 695a810386..7d7fe5e71c 100644 --- a/sysdeps/i386/nptl/tcb-offsets.sym +++ b/sysdeps/i386/nptl/tcb-offsets.sym @@ -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 diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h index 8ca0924692..6c36e58e9c 100644 --- a/sysdeps/i386/nptl/tls.h +++ b/sysdeps/i386/nptl/tls.h @@ -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. */ diff --git a/sysdeps/powerpc/nptl/tcb-offsets.sym b/sysdeps/powerpc/nptl/tcb-offsets.sym index 7c9fd33562..e5bb2b376d 100644 --- a/sysdeps/powerpc/nptl/tcb-offsets.sym +++ b/sysdeps/powerpc/nptl/tcb-offsets.sym @@ -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 diff --git a/sysdeps/s390/nptl/tls.h b/sysdeps/s390/nptl/tls.h index 37692e96ed..220bdfffb3 100644 --- a/sysdeps/s390/nptl/tls.h +++ b/sysdeps/s390/nptl/tls.h @@ -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; diff --git a/sysdeps/sh/nptl/tcb-offsets.sym b/sysdeps/sh/nptl/tcb-offsets.sym index 4963e1506f..234207779d 100644 --- a/sysdeps/sh/nptl/tcb-offsets.sym +++ b/sysdeps/sh/nptl/tcb-offsets.sym @@ -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 diff --git a/sysdeps/sparc/nptl/tls.h b/sysdeps/sparc/nptl/tls.h index 8a547f138e..2a79868ee2 100644 --- a/sysdeps/sparc/nptl/tls.h +++ b/sysdeps/sparc/nptl/tls.h @@ -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__ */ diff --git a/sysdeps/unix/sysv/linux/i386/lowlevellock.S b/sysdeps/unix/sysv/linux/i386/lowlevellock.S index 416b484170..feda390eeb 100644 --- a/sysdeps/unix/sysv/linux/i386/lowlevellock.S +++ b/sysdeps/unix/sysv/linux/i386/lowlevellock.S @@ -25,48 +25,16 @@ .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 diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 2ef2916a52..b90ea30195 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -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 diff --git a/sysdeps/unix/sysv/linux/lowlevellock-futex.h b/sysdeps/unix/sysv/linux/lowlevellock-futex.h index 4eddadb052..fc834ed16e 100644 --- a/sysdeps/unix/sysv/linux/lowlevellock-futex.h +++ b/sysdeps/unix/sysv/linux/lowlevellock-futex.h @@ -53,31 +53,16 @@ #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, ...) \ diff --git a/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/sysdeps/unix/sysv/linux/x86_64/cancellation.S index f3fb19dec2..53dbabd6d2 100644 --- a/sysdeps/unix/sysv/linux/x86_64/cancellation.S +++ b/sysdeps/unix/sysv/linux/x86_64/cancellation.S @@ -34,19 +34,8 @@ #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 diff --git a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S index 92561e1da0..71dd740202 100644 --- a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +++ b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S @@ -25,48 +25,16 @@ .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 diff --git a/sysdeps/x86_64/nptl/tcb-offsets.sym b/sysdeps/x86_64/nptl/tcb-offsets.sym index 8a25c482cb..be63404a16 100644 --- a/sysdeps/x86_64/nptl/tcb-offsets.sym +++ b/sysdeps/x86_64/nptl/tcb-offsets.sym @@ -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 diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h index 059f9675a0..6da1c04a98 100644 --- a/sysdeps/x86_64/nptl/tls.h +++ b/sysdeps/x86_64/nptl/tls.h @@ -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]; |