Commit Graph

274 Commits

Author SHA1 Message Date
Heinrich Schuchardt 344df36631 futex.2: clarify address mapping
Using the word "physical" address should make the text easier to
make.

Avoid negations like "may not be equal".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Heinrich Schuchardt 594536fb2c futex.2: tfix
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 4c8cb0ffe6 futex.2: Rewrap some long source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 83e80dda44 futex.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Heinrich Schuchardt 63ad44cb92 futex.2: simplify example
Do not duplicate coding.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Heinrich Schuchardt 92a4669004 futex.2: futex.2: Fix error check in EXAMPLE: fork() fails with -1
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 357646628c futex.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 077981d467 futex.2: Wrap sentences at line boundaries
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 74f58a643b futex.2: Explicitly mark FIXMEs added by Torvald Riegel
Mainly so I can keep track of who said what should be fixed/checked

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Torvald Riegel 4b35dc5dab futex.2: Terminology fixes
Here is the result of a first pass over futex.2.  I tried to
do nothing that is too controversial.  I tried to apply the
terminology that at least Darren and I had in mind
consistently; but please check again.

The major changes are in how futexes are described in the
introductory parts of the page.  I hope it's easier to understand
now.  I've also tried to add some more precision to the the
description of the synchronization semantics (e.g., it makes a
difference whether we claim something is atomic (without further
qualification), or just atomic wrt.  other futex operations).
In some cases, that adds some verbosity to the text -- but I
believe that this is worth the clarity and consistency in using
terms, for example.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 77da5febea futex.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 305cc4153b futex.2: Add EXAMPLE program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 02182e7c8c futex.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 1af427a43d futex.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 47f5c4baf5 futex.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk f529fd2013 futex Since Linux 2.6.22, EINTR can no longer occur on spurious wakeup
As reported by Rich Felker:

    I see no code in the kernel whereby a "spurious wakeup",
    or anything other than interruption by a signal handler
    that's not SA_RESTART, can cause futex to fail with EINTR.
    In general, overloading of EINTR and/or spurious EINTRs
    from a syscall make it impossible to use that syscall for
    implementing any function where EINTR is a mandatory
    failure on interruption-by-signal, since there is no way
    for userspace to distinguish whether the EINTR occurred
    as a result of an interrupting signal or some other
    reason. The kernel folks have gone to great lengths to fix
    spurious EINTRs (see signal(7) for history), especially by
    non-interrupting signal handlers, including in futex, and
    allowing EINTR here would be contrary to that goal.

     It's my belief that the "or a spurious wakeup" text should
     simply be removed.

     The reason I'm raising this topic is its relevance to a
     thread on libc-alpha:

     [RFC] mutex destruction (#13690): problem description and workarounds

The bug and mailing list discussions to which Rich refers are:
     https://sourceware.org/bugzilla/show_bug.cgi?id=13690
     https://sourceware.org/ml/libc-alpha/2014-12/threads.html#0001

Torvald Riegel also reported the same issue, and Thomas Gleixner
noted that the "EINTR on spurious wakeup" behavior went away in
Linux 2.6.22. See the LKML thread, "futex() man page update help
request", Jan 2015:
http://thread.gmane.org/gmane.linux.kernel/1703405/focus=7734

Reported-by: Rich Felker <dalias@libc.org>
Reported-by: Torvald Riegel <triegel@redhat.com>
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Michael Kerrisk <mtknpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 9732dd8b3f futex.2: Various fixes after review from Davidlohr Bueso
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 2abcba676a futex.2: Remove FUTEX_REQUEUE EINVAL error case
Thomas Gleixner confirmed my reading that this case does
not apply.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 9e2b90ee42 futex.2: Add an attmpt at a defintion of PI-aware futexes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk 7bd3ffbc52 futex.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:47 +01:00
Michael Kerrisk d9d5be6bea futex.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 809ca3ae64 futex.2: Note that the kernel only "knows" about a futex in the contended case
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk a663ca5a12 futex.2: Add some subsection headings
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk e219551457 futex.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk ed44c7c071 futex.2: Rewrite text on intended users of futexes
Eliminate some redundant text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk abb571e8b7 futex.2: Add text on pairing of FUTEX_WAIT_REQUEUE_PI + FUTEX_CMP_REQUEUE_PI
Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk f1d2171d38 futex.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk bdc5957afa futex.2: Process/thread rewordings
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk a59564304a futex.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 6700de2462 futex.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 7d20efd7b0 futex.2: Add overview of priority inheritance
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk b565548bfa futex.2: Add brief description of the priority inversion problem
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk dd003bef7a futex.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 8fe019c733 futex.2: SEE ALSO: add Documentation/robust-futex-ABI.txt
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 4cf9289452 futex.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk baf0f1f470 futex.2: Note that syscall() must be employed
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 4c2222812b futex.2: SEEL ALSO: add author details + other minor tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 939ca89f38 futex.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk d4ba43283d futex.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk a282e5b050 futex.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 30ebf7b4a1 futex.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 7f315ae3e5 futex.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 43d16602be futex.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 64191e8f09 futex.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk f2bf5121d5 futex.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 53ba4030d1 futex.2: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:46 +01:00
Michael Kerrisk 4e566b1ebd futex.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:45 +01:00
Michael Kerrisk e45f973525 futex.2: Clarify that FUTEX_PRIVATE_FLAG relates to *thread* synchronization
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:45 +01:00
Michael Kerrisk f19904c01c futex.2: wfix: mention "virtual" when talking about memory addreses
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:45 +01:00
Michael Kerrisk 70b06b9033 futex.2: srcfix
Various minor fixes to source

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-15 14:39:45 +01:00