feat(libkernel): implement _umtx_op UMTX_OP_SEM_WAIT and UMTX_OP_SEM_WAKE #8304
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8304"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-20T09:36:37Z.
What
Implements
_umtx_opUMTX_OP_SEM_WAIT(19) andUMTX_OP_SEM_WAKE(20) as FreeBSD 11'sdo_sem_waitanddo_sem_wake(built underCOMPAT_FREEBSD9/10, as the console answers them) onstruct _usem { _has_waiters, _count, _flags }. A wait sets_has_waitersto 1 when it is 0, returns at once while_countis non-zero, and otherwise sleeps on the semaphore's queue with the timeout read as forUMTX_OP_WAIT. A wake clears_has_waiterswhen one waiter is left and releases one waiter. The waiter queue now takes a readiness check, so a semaphore wait uses the same queue assceKernelSyncOnAddressWait.UMTX_OP_SEM2_WAITandUMTX_OP_SEM2_WAKEstill throw.Overlap: #2528 ("shard SyncOnAddress waiters across hashed buckets", by nahshongraham97) changes the same waiter queue in
SyncOnAddress.cpp. Its sharding is ported onto currentmainin a separate PR, so this PR does not carry it. Whichever of the two merges second rebases onto the other.The debt entry for
_umtx_opis updated to list only what is still open.Credit: the semaphore behaviour follows FreeBSD 11's
kern_umtx.c.Tested
Linux x86-64 (CachyOS, kernel 7.2.10): the focused
guest_umtx_optest passes on the rebased branch (ctest -R '^guest_umtx_op$', 4 new cases for the semaphore operations);tools/check_conventions.py --base origin/mainpasses. Not tested on a title: no title reachedUMTX_OP_SEM_WAITorUMTX_OP_SEM_WAKEin the runs done here (Sonic Superstars, PPSA06888, stops before it), so this change has no title log yet.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-20T09:36:57Z.
This overlaps #2528 ("shard SyncOnAddress waiters across hashed buckets", @FitzVB). Both change the waiter queue in
SyncOnAddress.cpp. This PR keeps the single queue and adds the semaphore operations on top of it; #2528 shards that queue. Whichever merges second rebases onto the other. Credit to @FitzVB for the bucket design; the comment on #2528 lists what this PR's queue calls need from a sharded version.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:45:47Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel/SyncOnAddress/src/SyncOnAddress.cppL75-77, L79-80, L106-107, L110docs/dev/debt/libkernel.mdL56-58Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libkernel/SyncOnAddress/src/SyncOnAddress.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/tests/GuestUmtxOp.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-20T10:00:10Z.
This PR now includes the sharding commit from #2528 (
e3eb745c9, credited to @nahshongraham97), ported onto the semaphore queue. That makes it two topics; the PR body says so. The semaphore operations and the sharding touch the same queue, so landing them together avoids a second rebase.Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-20T10:05:42Z.
Correction: the sharding commit was moved out of this PR to #8323 (one topic per PR, per CONTRIBUTING). This PR is the semaphore operations only, and its body is updated to match.