fix(libkernel): report the console's scheduling priority range #4077
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4077"
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 hugodearaujo on 2026-10-11T22:48:26Z.
What
sched_get_priority_maxreturned 256 andsched_get_priority_min767 for policies 1 to 3, and other policies threw. TechnicalDebt said the console's answer was unverified. I called the console's exports from a homebrew payload on a PS5 (firmware 13.60):mainmax / minSCHED_FIFO)SCHED_RR)SCHED_OTHER)So the range was swapped, and every policy without a range fails with
EINVALinstead of a host exception. A second check agrees: on the console a mutex attribute set toPTHREAD_PRIO_PROTECTreports a default ceiling of 767, the highestSCHED_RRpriority in FreeBSD libthr.pthread_mutexattr_setprotocolhere takes that ceiling fromsched_get_priority_max(SCHED_RR), so onmainit is 256; this change fixes it too.Title: Propagation: Paradise Hotel (PPSA15878) sets its thread priorities this way (
eboot.bin0x4b75d60):Threads report
SCHED_FIFOboth on the console and here, so with the swapped range each level got the mirrored priority: level 4 gave 767 instead of 256.The
SCHED_OTHERrange was accepted for SDL titles (#1908). SDL now gets -1 andEINVAL, as on the console, instead of an exception or a range.The TechnicalDebt entry gives the measurements. It also notes what is still different and left for a separate change:
pthread_setschedparamignores the policy and does not check the priority, where the console rejectsSCHED_OTHERand priorities below 256 withEINVAL.Tested
pthread_getschedparamon the main thread and on a created thread (bothSCHED_FIFO).guest_sched_prioritynow checks both ranges and theEINVALcases; it aborts onmain.guest_pthread_mutexattralready compares the ceiling withsched_get_priority_max(SCHED_RR)and passes.maindoes not build on Windows (HostPollinSocket.cpp, fixed by #4021), so I built this branch with #4021 merged: 903/905,guest_sched_priorityandguest_pthread_mutexattrpass.agc_write_trackingandguest_kernel_stack_protectfail the same way onmainwith #4021 in this VM.Overlap: #3654 adds its
getpriorityTechnicalDebt entry right below the entry this PR rewrites, so whichever lands second needs a one-line rebase. #3654 already conflicts withmainelsewhere.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code