Page MenuHomeFreeBSD

_utmx_op: don't recurse on chain busy
ClosedPublic

Authored by kevans on Sat, Nov 9, 5:44 AM.
Tags
None
Referenced Files
F102575821: D47493.id.diff
Thu, Nov 14, 6:35 AM
F102549187: D47493.diff
Wed, Nov 13, 10:19 PM
Unknown Object (File)
Tue, Nov 12, 10:00 PM
Unknown Object (File)
Mon, Nov 11, 10:18 AM
Unknown Object (File)
Mon, Nov 11, 1:59 AM
Unknown Object (File)
Sun, Nov 10, 6:21 PM
Unknown Object (File)
Sun, Nov 10, 3:51 AM
Unknown Object (File)
Sat, Nov 9, 11:48 PM
Subscribers

Details

Summary

In handling a PP mutex, we'll busy it as soon as we enter the loop and
unbusy it either prior to sleeping or at exit time. In this particular
case, if we fail to transition the mutex from OWNERDEAD -> owned because
of casueword(9) failure and the suspend check fails, we'll start over
and attempt to busy an already-busied chain and irrecoverably lock up
both this thread and anything else that tries to busy the chain.

Unbusy the chain prior to restarting because I couldn't decide if that
was a better or worse idea than just keeping track of whether we dirtied
it in do_lock_pp() and avoiding re-dirty. This is marginally easier to
reason about as it returns us to expected state on entry to thw loop.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60453
Build 57337: arc lint + arc unit

Event Timeline

kevans requested review of this revision.Sat, Nov 9, 5:44 AM

Unbusy the chain prior to restarting because I couldn't decide if (...)

I suspect it is marginally better to do that, as if the thread lost the race, some other revived the mutex, probably to lock it, and has thus been running enough to have a more up-to-date view of its (and surrounding) state. In any case, I agree the code is easier to grasp like that.

sys/kern/kern_umtx.c
2608–2617

This is unrelated to your changes here, but since the setting of error to EBUSY here is never observed (as error is then reset to 0 unconditionally), I'd suggest simplifying the code while here.

This revision is now accepted and ready to land.Sat, Nov 9, 10:13 AM
This revision was automatically updated to reflect the committed changes.