On Fri Jun 25 2021, Kurt Kanzenbach wrote: > Linux real time applications often make use of mutexes with priority inheritance > enabled due to problems such as unbounded priority inversion. In addition, some > applications make use of timeouts e.g., by utilizing pthread_mutex_clocklock(). > > However, the combination of priority inheritance enabled mutexes with timeouts > based on CLOCK_MONOTONIC doesn't work. That is because the underlying Linux > kernel futex interface didn't support it, yet. Using CLOCK_REALTIME is possible, > but it is subject to adjustments (NTP, PTP, ...). Therefore, Thomas proposed and > introduced a new futex operation called FUTEX_LOCK_PI2 with support for > selectable clocks [1]. > > Here is a proof of concept patch set adding FUTEX_LOCK_PI2 in order to support > pthread_mutex_clocklock(MONOTONIC)/PI. The idea is to use futex_lock_pi2() by > default, and fallback to futex_lock_pi() in case the kernel is too old. > > There's also a bugreport for glibc with a test case: > > https://sourceware.org/bugzilla/show_bug.cgi?id=26801 > > Changes since RFC: > > * FUTEX_LOCK_PI2 merged in upstream Linux kernel (Thomas Gleixner, Peter Zijlstra) > * Make of __ASSUME_FUTEX_LOCK_PI2 in the implementation (Adhemerval Zanella) > * Get rid of probing for FUTEX_LOCK_PI2 in timedlock (Adhemerval Zanella) > * Adjust the test cases (Adhemerval Zanella) > * Use correct Linux kernel version (Joseph Myers) > > Previous versions: > > * https://sourceware.org/pipermail/libc-alpha/2021-June/127798.html Ping. Any comments on this version? Thanks, Kurt