Page MenuHomeFreeBSD

Document robustness implementation and quirks.
ClosedPublic

Authored by kib on May 17 2016, 10:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 11 2024, 5:50 PM
Unknown Object (File)
Nov 10 2024, 7:42 PM
Unknown Object (File)
Oct 8 2024, 12:24 AM
Unknown Object (File)
Oct 3 2024, 4:22 PM
Unknown Object (File)
Sep 18 2024, 8:48 AM
Unknown Object (File)
Sep 16 2024, 4:58 PM
Unknown Object (File)
Sep 13 2024, 4:54 PM
Unknown Object (File)
Sep 8 2024, 11:01 PM
Subscribers

Details

Summary

Documented robustness for _umtx_op(2), and updated libthr(3) for knobs added by robust mutexes commit,

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib retitled this revision from to Document robustness implementation and quirks..
kib updated this object.
kib edited the test plan for this revision. (Show Details)
kib added reviewers: emaste, manpages.
kib set the repository for this revision to rS FreeBSD src repository - subversion.
kib edited edge metadata.

Some rewording.

As usual lots of minor comments on articles, and a few confusing parts

lib/libc/sys/_umtx_op.2
108 ↗(On Diff #16524)

a non-recoverable state

126 ↗(On Diff #16524)

I think robust is a name that's not particularly descriptive, and wonder if we should say something like
Mutex is robust, as described in the ROBUST UMUTEXES section below

128 ↗(On Diff #16524)

in a transient

441 ↗(On Diff #16524)

On thread termination, the kernel walks two lists of mutexes.

442 ↗(On Diff #16524)

Probably
The two list head addresses must be provided by a prior

445 ↗(On Diff #16524)

singly-linked. The link to the next

450 ↗(On Diff #16524)

the kernel
"either" implies there will be two conditions.

What about:

Robust list processing is aborted if the kernel finds a mutex with any of the following conditions:

  • the UMUTEX_ROBUST flag is not set
  • not owned by the current thread, except...
  • the combination of flags is invalid
  • read of the umutex memory faults
  • the list length limit described in libthr(3) is reached
453 ↗(On Diff #16524)

without the

473 ↗(On Diff #16524)

For each iteration, the mutex is

Although perhaps there's no need to refer to iterating here at all, and just describe it as:

Every mutex in both lists is unlocked as if...

484 ↗(On Diff #16524)

Perhaps: is locked using the UMTX_OP_MUTEX_LOCK operation?
I.e., because lock here refers to the operation, not a state?

488 ↗(On Diff #16524)

Also, the kernel handles the UMUTEX_RB_NOTRECOV value of the m_owner field specially, always returning the ENOTRECOVERABLE error for lock attempts, without granting the lock.

1163 ↗(On Diff #16524)

The plurals seem awkward to me here. Does "register the list heads for the current thread's robust mutex lists" seem OK?

Or, Register the robust lists's heads for the curren thread

1186–1187 ↗(On Diff #16524)

shared robust locked mutexes seems confusing
does "element in the list of locked robust shared mutexes" seem OK?

1197 ↗(On Diff #16524)

a pointer to

1202 ↗(On Diff #16524)

The kernel inspects

1205–1209 ↗(On Diff #16524)

seems like something is missing here. Right now, it reads as "if the mutex ... is handled more loose," ... then what?

1289 ↗(On Diff #16524)

Maybe umutex where the m_owner field

1302 ↗(On Diff #16524)

The lock was

1353 ↗(On Diff #16524)

unlocking a robust

1357 ↗(On Diff #16524)

allows another thread

1363 ↗(On Diff #16524)

A possible... strengthen the checks

lib/libthr/libthr.3
208 ↗(On Diff #16524)

by a mapped file

211 ↗(On Diff #16524)

makes such a shared lock object persist ...

212 ↗(On Diff #16524)

by the Virtual

213 ↗(On Diff #16524)

mapped, the kernel

217 ↗(On Diff #16524)

The kernel will...

222 ↗(On Diff #16524)

A non-zero value makes...

223 ↗(On Diff #16524)

prematurely aborted after detecting some inconsistency, as a...

231 ↗(On Diff #16524)

locks a given

kib marked 28 inline comments as done.
kib edited edge metadata.

Apply the editings after emaste review.

emaste edited edge metadata.

LGTM with one remaining nit.

lib/libc/sys/_umtx_op.2
1215 ↗(On Diff #16567)

loosly

This revision is now accepted and ready to land.May 19 2016, 5:28 PM
This revision was automatically updated to reflect the committed changes.