about summary refs log tree commit diff
path: root/sysdeps/nptl/futex-internal.c
Commit message (Collapse)AuthorAgeFilesLines
* nptl: Remove _futex_clock_wait_bitset64Adhemerval Zanella2020-11-251-46/+0
| | | | | | | | It can be replaced with a __futex_abstimed_wait64 call. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Consolidate __futex_abstimed_wait_{cancelable}64Adhemerval Zanella2020-11-251-76/+35
| | | | | | | | The only different is how to issue the syscall. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Extend __futex_abstimed_wait_cancelable64 commentAdhemerval Zanella2020-11-251-6/+2
| | | | | | | | | And add a small optimization to avoid setting the operation for the 32-bit time fallback operation. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* y2038: nptl: Provide __futex_clock_wait_bitset64 to support 64 bit bitsetLukasz Majewski2020-10-211-1/+47
| | | | | | | | | | | | | | | The commit: "y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit" SHA1: 29e9874a048f47e2d46c40253036c8d2de921548 introduced support for 64 bit timeouts. Unfortunately, it was missing the code for bitset - i.e. lll_futex_clock_wait_bitset C preprocessor macro was used. As a result the 64 bit struct __timespec64 was coerced to 32 bit struct timespec and regression visible as timeout was observed (nptl/tst-robust10 on s390). Reported-by: Stefan Liebler <stli@linux.ibm.com> Tested-by: Stefan Liebler <stli@linux.ibm.com>
* y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bitLukasz Majewski2020-10-151-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pthread_mutex_clocklock and pthread_mutex_timedlock have been converted to support 64 bit time. This change uses: - New __futex_clocklock_wait64 (instead of lll_timedwait) from ./sysdeps/nptl/futex-helpers.c and - New __futex_clocklock64 function (instead of lll_clocklock) - New futex_lock_pi64 defined in sysdeps/nptl/futex-internal.h The pthread_mutex_{clock|timed}lock only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer to the syscalls as those calls have exported symbols marked with __nonull attribute for abstime. Some architectures - namely x86, powerpc and s390 - do support lock elision. For those - adjustments have been made in arch specific elision-*.c files to use __futex_clocklock64 instead of lll_clocklock. The __lll_lock_elision (aliased to __lll_clocklock_elision in e.g. sysdeps/unix/sysv/linux/s390/elision-timed.c) just uses, in this patch provided, __futex_clocklock64. For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to pthread_mutex_{clock|timed}lock will provide support for 64 bit time Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Y2038: nptl: Provide futex_abstimed_wait64 supporting 64 bit timeLukasz Majewski2020-10-041-0/+70
| | | | | | | | | | | | | | | | | | This is the helper function, which uses struct __timespec64 to provide 64 bit absolute time to futex syscalls. The aim of this function is to move convoluted pre-processor macro code from sysdeps/nptl/lowlevellock-futex.h to C function in futex-internal.c The futex_abstimed_wait64 function has been put into a separate file on the purpose - to avoid issues apparent on the m68k architecture related to small number of available registers (there is not enough registers to put all necessary arguments in them if the above function would be added to futex-internal.h with __always_inline attribute). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* nptl: Provide proper spelling for 32 bit version of futex_abstimed_waitLukasz Majewski2020-09-301-6/+6
| | | | | | | This change provides proper spelling of 32 bit __futex_abstimed_wait_cancelable32 function Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* nptl: Fix __futex_abstimed_wait_cancellable32Adhemerval Zanella2020-09-281-4/+10
| | | | | | | | Similar to 64-bit time __futex_abstimed_wait_cancellable64, it should check for overflow and convert to 32-bit timespec iff timeout is not NULL. It fixes some regression on i686-linux-gnu running on a 4.15 kernel.
* nptl: futex: Provide correct indentation for part of ↵Lukasz Majewski2020-09-091-3/+3
| | | | | | | __futex_abstimed_wait_cancelable64 By mistake the if for calling __futex_abstimed_wait_cancellable32 was misaligned with the rest of the function body.
* y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit timeLukasz Majewski2020-09-021-0/+95
The pthread_cond_clockwait and pthread_cond_timedwait have been converted to support 64 bit time. This change introduces new futex_abstimed_wait_cancelable64 function in ./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible and tries to replace low-level preprocessor macros from lowlevellock-futex.h The pthread_cond_{clock|timed}wait only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer as __pthread_cond_wait_common() always passes non-NULL struct __timespec64 pointer to futex_abstimed_wait_cancellable64(). For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to __pthread_cond_{clock|timed}wait64 will provide support for 64 bit time The futex_abstimed_wait_cancelable64 function has been put into a separate file on the purpose - to avoid issues apparent on the m68k architecture related to small number of available registers (there is not enough registers to put all necessary arguments in them if the above function would be added to futex-internal.h with __always_inline attribute). In fact - new function - namely __futex_abstimed_wait_cancellable32 is used to reduce number of needed registers (as some in-register values are stored on the stack when function call is made). Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test the proper usage of both __pthread_cond_{clock|timed}wait64 and __pthread_cond_{clock|timed}wait. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>