Skip to content

futex: Bugfixes and FUTEX_LOCK_PI2

Thomas Gleixner lkml stable 1 version Applied

Status from this message: The following commit has been merged into the locking/urgent branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 9 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/6Revert 337f13046ff0 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")kernel/futex.c+1 -20 replies
2/6futex: Do not apply time namespace adjustment on FUTEX_LOCK_PIkernel/futex.c+2 -20 replies
3/6futex: Get rid of the val2 conditional dancekernel/futex.c+2 -143 replies
4/6futex: Make syscall entry points less convolutedkernel/futex.c+37 -260 replies
5/6futex: Prepare futex_lock_pi() for runtime clock selectionkernel/futex.c+3 -22 replies
6/6futex: Provide FUTEX_LOCK_PI2 to support clock selectioninclude/uapi/linux/futex.h kernel/futex.c+6 -12 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPeter Zijlstra (Intel)
SeriesA-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/6] futex: Bugfixes and FUTEX_LOCK_PI2

The following series started off looking into supporting selectable clocks for FUTEX_LOCK_PI which is hardcoded to CLOCK_REALTIME and cannot be changed.

On the way I found two bugs related to the timeout handling:

- The allowance for FUTEX_WAIT to use FUTEX_CLOCK_REALTIME is broken and never worked.

- The recent time namespace support wreckaged FUTEX_LOCK_PI timeouts when the task belongs to a namespace which has an CLOCK_MONOTONIC offset.

Both should have been caught by that Gleixner dude when merging them, but it seems he's getting old.

Not having a selectable clock for PI futexes is inconsistent because all other interfaces have it. Unfortunately this was figured out by glibc folks quite some time ago, but nobody told us :(

The nasty hack to support it would be to treat FUTEX_CLOCK_REALTIME inverse for FUTEX_LOCK_PI, but that's a horrible idea. Adding a new flag to the futex op, i.e. FUTEX_CLOCK_MONOTONIC would be possible, but that's yet another variant which makes is harder for libraries to have a consistent clock selection handling.

So I went the way to let FUTEX_LOCK_PI alone and to add FUTEX_LOCK_PI2 which handles the clocks the same way as the other operands.

Thoughts?

The series is also available from git:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git futex

Thanks,

tglx

---
 include/uapi/linux/futex.h |    1 
 kernel/futex.c             |   89 +++++++++++++++++++++++----------------------
 2 files changed, 47 insertions(+), 43 deletions(-)