Commit Graph
4 Commits
Author SHA1 Message Date
cocoa55andClaude Opus 5.5 8c4cdf84a2 test(libkernel): count the yields a woken condition variable wait makes
The mutex yield step counts each yield in a counter that
MutexYieldsForTest_nid_no_patch reads. With no spins and a yield count
of 5, a waiter woken while another thread holds its mutex must yield
exactly 5 times before it blocks, for each mutex type and for the outer
level of a recursive mutex held twice. With WakingLock::lock calling
the native lock directly the count stays 0 and the test aborts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 23:37:35 -04:00
cocoa55andClaude Opus 5.5 16375634e3 fix(libkernel): spin and yield when a condition variable wait relocks its mutex
FreeBSD 11.4's _mutex_cv_lock takes the mutex back through
mutex_lock_common, so a woken waiter tries once, spins and yields by
the mutex's counts before it blocks. The wait here called the native
lock directly; it now goes through the same spin and yield path as
scePthreadMutexLock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 22:47:35 -04:00
cocoa55andClaude Opus 5.5 32abcb15a0 fix(libkernel): try a mutex once before its spin and yield budget
FreeBSD's mutex_lock_common tries the lock before mutex_lock_sleep
spins or yields, so a free mutex with yield loops and no spins was
yielding before its first try here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:30:54 -04:00
cocoa55andClaude Opus 5.5 9a7acb3677 fix(libkernel): spin and yield by the mutex spin and yield loop counts
Lock and timed lock now try the mutex up to the spin count with a pause
between tries, then up to the yield count with a yield before each try,
before they block, as FreeBSD 11.4's mutex_lock_sleep does. Trylock and
a lock the thread already holds do not spin. A uniprocessor host skips
the spins and keeps the yields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:56:31 -04:00