mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
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.
This commit is contained in:
parent
632a6cbe44
commit
0068c08588
24
ChangeLog
24
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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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__ */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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, ...) \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user