Repository navigation
feat(libkernel): support cpuset affinity by guest thread ID - #6540
Conversation
|
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.
|
|
Windows run of head
Titles. In the relinked titles I have,
PPSA99082's logs are the same on both sides apart from pointers and paths. Not checked: Linux, PS5 hardware, and any title that sets or queries another thread's affinity (none available here). #6447 edits the same Written with Claude Code assistance (validation by a subagent, reviewed in this session). |
What
With
CPU_LEVEL_WHICH/CPU_WHICH_TID,cpuset_getaffinityandcpuset_setaffinitycurrently throw when the requested TID belongs to another live guest thread. Resolve that guest TID in the live-thread registry and read or update the selected thread's affinity. Lookup and access hold the registry lock so removal and release cannot pass between them; a thread that exits before the setter's final lookup returnsESRCH.The worker observes the new affinity,
sceKernelGetCurrentCpureports a CPU within it, and a subsequently created child inherits it. The calling thread's mask stays intact. Existing mask validation, process-wide operations and unsupported ROOT/CPUSET levels remain covered.Thread selection follows FreeBSD 11.4 cpuset_which and kern_cpuset_getaffinity/kern_cpuset_setaffinity. This expands the existing guest affinity model: affinity is recorded for guest CPU reporting and inheritance, not applied to host scheduler affinity. PS5 hardware behavior is unmeasured; the library debt entries record the remaining limits. No new exports or title/FPS gain is claimed.
Tested
Arch Linux, Ryzen 9 7950X, Release, bundled dependencies, main
44df21632125dbe3113a19173e7ebb879da53003.libsbuild passed. Seven checks passed, zero skips:guest_available_cpumask,guest_current_cpu,guest_pthread_start,guest_thread_cpu_clock,guest_pthread_join_self,guest_pthread_destructor_lifetime,guest_pthread_attr.ESRCHwith an untouched output after join. Existing self/process, invalid argument and unsupported-level checks remain.cpuset_getaffinity other than the calling thread or process not implemented.60798920d5b6c0d174f72ad27b17f7d62806b9891b2c40f5d52b35161f78d452.External Windows validation
screamm’s independent report tests head
7777219eemerged onto main5d9dcc42d, using Windows11, Ryzen75700X, RTX4070 and MinGW GCC15.2. Runtime libraries build, and the seven affinity/thread checks pass three repetitions (21runs). Parent-source and no-op-setter negative controls fail; restoration passes. Their broader build still encounters main’s known MinGW64KiB-alignment AGC test issue. Reported load-related non-GPU test failures pass on serial reruns; this is not a new full-suite pass claimed here.Their diagnostic title runs reach only the calling-thread query path. No title exercises another-thread affinity, and the timed runs end by termination. No title unblock, ordinary-close stability or FPS improvement is established. These are contributor-reported Windows results, separate from our Linux checks above.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository