Repository navigation
feat(libkernel): implement pthread_mutex_setname_np, pthread_rwlock_setname_np and pthread_barrier_setname_np - #10385
Conversation
Progress report (b282541 → cf2aa7c)📈 System libraries: 51.06% (+0.02%, +3 implemented, -3 removed functions) ✅ 3 implemented
🗑️ 3 removed
Changed libraries (implemented exports)
|
|
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.
Some 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.
|
|
Ran this on Windows 11 (WinLibs GCC 15.2.0, Ninja), merging the PR head (7a05396) onto current main (dcd7e3a). The merge is clean. Built and ran every pthread test that has a build target: 28 of 28 passed, including
Not run: |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the full three-function diff at 7a05396, including the pthread object state, lock coverage, discovery-export removal, tests and debt entries. The invalid/static/destroyed cases are handled consistently with the source evidence described in the PR, and the behavior limits are recorded rather than guessed. The author reports the full Linux test result; the independent Windows report confirms all 28 built pthread tests pass, including the new setname test. Hosted Linux/Windows product builds are skipped by workflow policy, so I am not treating them as run. No blocking issue found.
|
|
|
@alvaroelpob Since #10173 merged, this branch conflicts with main in |
7a05396 to
17dd582
Compare
|
Rebased on |
|
@alvaroelpob Please drop the two new throw cases for the static and adaptive mutex initializers in GuestPthreadSetname.cpp:37 and :40. These are valid initializer forms, but naming them is intentionally unsupported, so the test should not pin that limitation. Keep supported naming and genuine null/destroyed-object validation, then rerun guest_pthread_setname and the mutex/rwlock/barrier regressions on Linux and Windows. The agreed #9156-first order still applies. |
…_setname_np, pthread_rwlock_setname_np and pthread_barrier_setname_np Took the PR's three libkernel exports (they store the name) and its test; dropped our name-discarding mutex/rwlock copies from libkernel_sys/Pthread.cpp (libkernel_sys imports fall back to libkernel) and the barrier stub, kept our cond/sem setname and the GuestKernelSys checks, trimmed the libkernel_sys debt line to cond/sem. (cherry picked from commit fae34fbcc2bf375603e70d3287c45b8122dabd9c)
|
@oneandonlydean Dropped the static and adaptive initializer cases from the mutex test in ca27388; the supported naming, null-pointer and destroyed-mutex checks stay. On Linux (Ubuntu 26.04 WSL2, GCC 15.2.0) |
|
@alvaroelpob #11230 removes the |
|
Windows run, which the description doesn't cover. Head
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
On "no console measurement or firmware disassembly settles these": I ran the three exports of firmware 13.42's All three functions work the same way, each on its own field:
Per the disassembly only (not reached in these runs): the mutex function has one more branch. When its field holds Not covered: what the kernel's |
|
@BunnyFl Thanks, this is the kind of evidence these functions were missing. The second-call result (0x23 with no syscall) and the unchecked null name differ from what the current tests expect, so we're checking the PR's assertions against your results. @alvaroelpob please take a look too, particularly the repeated rename and the null-name cases. |
|
@alvaroelpob Thanks. BunnyFl's firmware 13.42 run (#10385 (comment)) settles part of what the debt entries call unverified, so a few changes, please:
|
…the mutex setname test
ca27388 to
cf2aa7c
Compare
|
@oneandonlydean @BunnyFl thanks. All four points are done; the head is now cf2aa7c.
The debt entries also say that the console stores the |
What
Implements
pthread_mutex_setname_np,pthread_rwlock_setname_npandpthread_barrier_setname_npin libkernel, one commit each, and removes their throwing stubs from the libkernel_sys discovery exports. This follows #9962, which does the same forpthread_cond_setname_np.BunnyFl's run of firmware 13.42's
libkernel.sprxon a PC settles most of the behaviour. The module dereferences the object first, then passesnameto the kernel'snamedobj_createand stores the returned id; a second call on a named object returnsEAGAIN(35) without a syscall. A nullnamegoes to the kernel unchecked, so its result is unmeasured.pthread_mutex_setname_np(mutex, name)nameand returns 0; once named, every later call returnsEAGAINand keeps the name. Nullname(unmeasured): returns 0 and leaves the mutex unnamedpthread_rwlock_setname_np(rwlock, name)nameand returns 0; once named,EAGAIN. Nullname(unmeasured): returnsEINVAL, following shadPS4pthread_barrier_setname_np(barrier, name)nameand returns 0; once named,EAGAIN. Nullname(unmeasured): returns 0 and leaves the barrier unnamedThe console keeps the kernel's id, not the string; here the name is copied under the object's lock (the mutex initialization lock, the rwlock state mutex, or the barrier mutex) and nothing reads it back. Each function has its own debt entry with these gaps.
Tested
Ubuntu (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmainaca451e.guest_pthread_setnametest. Each commit adds the block for its function, and each commit was built and its test andcheck_conventions.pyrun on its own. After cf2aa7c it checks, for each of the three objects, a first rename (read back from the object),EAGAINwith the name unchanged for a later rename (also while the mutex is locked, the rwlock read-locked, or after a barrier wait), and a throw for a null pointer and a destroyed object, plus an unset rwlock and barrier.nm -Don the builtlibkernel.prxshows the three exports.ctest -j16at the last commit: 1992/1993 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.maine7e3e9c, head 17dd582: since fix(libkernel): store only rwlock attribute types 1 and 2 #10173 merged, the branch conflicted inRwlock.cpp. Main's refactor(libs): add full export headers for libs #10706 movedPthreadBarrierPrivateintolibkernel/include/Api.hpp, so the barrier commit addsnamethere. 17dd582 (refactor(libkernel): declare the setname exports in the public header) declares the three exports with their real signatures inlibkernel/include/Api.hpp, removes their(void)stubs fromlibkernel_sys/include/Api.hppand drops the test's redeclarations, whichpublic_headersnow rejects. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.guest_pthread_setnamepasses; full build andctest -j16onmaine7e3e9c: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses. Not tested: Windows.main2dbe9b9, head b78878a, to resolve the conflicts from feat(libkernel): add pthread_rwlockattr_settype_np and scePthreadMutexattrSetkind #9632 and feat(libkernel): add pthread_cond_setname_np #9962 inlibkernel_sys/Export.Discovery.cppandlibkernel_sys/include/Api.hpp; both sides' stub removals are kept. Review fix cf2aa7c follows the 13.42 run: a later rename of a named object returnsEAGAIN, the null-name assertions are gone and the null name is marked unmeasured in the debt, and the inputs that fault in the module throw; the debt entries are rewritten. Full build andctest -j16: 2370/2371 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses. Not tested: Windows.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)