umtx_lock MTX_SPIN->MTX_DEF

John Baldwin jhb at freebsd.org
Thu Feb 26 17:15:29 UTC 2015


On Thursday, February 26, 2015 12:39:41 PM Konstantin Belousov wrote:
> Recent silly discussion on arch@ reminded me about umtx_lock, which is
> used by top-half of the kernel, but which is spin lock. Apparently, the
> only reason for this is that umtx_thread_exit() is called under the
> process spinlock, which put the requirement on the umtx_lock. Note that
> the witness static order list is wrong for the umtx_lock, umtx_lock is
> explicitely before any thread lock, so it is also before sleepq locks.
> I think it went unnoticed because witness for spinlocks currently broken
> due to console locks.
> 
> Below is the patch which changes umtx_lock to the sleepable mutex.  For the
> reason above, I have to move calls to umtx_thread_exit() from thread_exit()
> earlier in each caller, when the process spin lock is not yet taken.
> 
> Patch was lightly tested.  Please review the idea.

Definitely a fan of the idea, and after a cursory look, the patch seems ok.

-- 
John Baldwin


More information about the freebsd-threads mailing list