[0/4] Add CLOCK_MONOTONIC support for PI mutexes

Message ID 20210811200133.3869287-1-adhemerval.zanella@linaro.org
Headers
Series Add CLOCK_MONOTONIC support for PI mutexes |

Message

Adhemerval Zanella Netto Aug. 11, 2021, 8:01 p.m. UTC
  This patchset is a respin from previous set [1] with some code
simplification and tests refactor.

As before, it add support for CLOCK_MONOTONIC for PI mutexes by
using the new Linux v5.14 FUTEX_LOCK_PI2 operation.  Similar to
current approach, pthread_mutex_clocklock might return EINVAL if
the underlying kernel has no support for the futex operation.

Changes since v1:
  
  * Refactor futex_lock_pi64 and avoid adding futex_lock_pi2.  The
    FUTEX_LOCK_PI2 logic is done at only one place, so the code change
    on pthread routines are minimal.  Also, FUTEX_LOCK_PI2 is only
    used if it is really required, i.e, when a timeout against
    CLOCK_MONOTONIC is used.
  * Do not remove nptl/tst-mutexpi10.c, but instead adjust it to new
    FUTEX_LOCK_PI2 support.
  * Add pthread_mutex_pi_support_monotonic() to check if monotonic
    clock with PI mutexes are supported and use on test to check for
    the expected result.

[1] https://patchwork.sourceware.org/project/glibc/list/?series=2372

Adhemerval Zanella (3):
  nptl: Use FUTEX_LOCK_PI2 when available
  support: Add xpthread_mutex_pi_support_monotonic
  nptl: Add CLOCK_MONOTONIC support for PI mutexes

Kurt Kanzenbach (1):
  Linux: Add FUTEX_LOCK_PI2

 nptl/futex-internal.c                         | 63 +++++++++++++++++++
 nptl/pthread_mutex_lock.c                     |  3 +-
 nptl/pthread_mutex_timedlock.c                | 10 +--
 nptl/tst-mutexpi10.c                          | 42 ++++++++-----
 support/Makefile                              |  1 +
 support/xpthread_mutex_pi_support_monotonic.c | 33 ++++++++++
 support/xthread.h                             |  4 ++
 sysdeps/nptl/futex-internal.h                 | 54 +---------------
 sysdeps/nptl/lowlevellock-futex.h             |  1 +
 sysdeps/pthread/tst-mutex5.c                  | 23 ++++---
 sysdeps/pthread/tst-mutex9.c                  | 20 +++---
 sysdeps/unix/sysv/linux/kernel-features.h     |  8 +++
 12 files changed, 170 insertions(+), 92 deletions(-)
 create mode 100644 support/xpthread_mutex_pi_support_monotonic.c