fix(libkernel): return timeout on zero usec in AIO wait #13224
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13224"
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 fogydes on 2026-10-30T07:05:47Z.
What
In
sceKernelAioWaitRequestsandsceKernelAioWaitRequest(core/libs/prx/libkernel/Aio/src/Aio.cpp:383,414), evaluate the elapsed timeout wheneverusec != nullptr, checkingelapsed >= static_cast<std::int64_t>(*usec).Previously, timeout handling was guarded by
if (usec != nullptr && *usec != 0). While shadPS4 skips its timeout check when*usec == 0(treating zero like an indefinite wait), AnyPS5 distinguishes a null timeout pointer (usec == nullptr, indefinite wait) from a pointer to zero (*usec == 0, immediate poll returningSCE_KERNEL_ERROR_ETIMEDOUTwhen requests remain inAioProcessing, without enteringPreciseSleepUs). This is adopted as an intentional host policy pending PS5 console measurement or library disassembly, and is documented indocs/dev/debt/libkernel.md. The positive-timeout boundary check also changes from>to>= static_cast<std::int64_t>(*usec), expiring immediately once the elapsed deadline is reached rather than waiting through an additional iteration at exact equality.Test coverage in
core/libs/tests/GuestAioRegistry.cppis extended to verify:SCE_KERNEL_ERROR_ETIMEDOUTand reports state2(AioProcessing).0(success) and reports completion state, verifying that completion is checked before timeout evaluation.AioWaitAndreturnsSCE_KERNEL_ERROR_ETIMEDOUT, while modeAioWaitOrreturns0(success) upon finding an already completed request.Tested
Windows 11,
ctest --test-dir build -R "guest_aio" -Vpassed 100% (8/8 tests passed, 5/5 repetitions clean).python tools/check_conventions.py --base origin/mainpassed with 0 findings.python tools/pr_overlap.py --branch fix/libkernel-aio-zero-timeoutpassed cleanly across all 1518 open pull requests (1 expected overlap with PR #7121 onAio.cpp).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)Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:42Z.
Review: COMMENTED
Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement;
Unblocks: noneis allowed. The technical points below are unaffected.No title ID or log line. "Unblocks: none", and nothing shows a title calling
sceKernelAioWaitRequest(s)with a pointer to a zero timeout on main. Please add the title and the log line that reaches it.This is a guess recorded as policy. The body says a zero timeout returning
ETIMEDOUTimmediately is "adopted as an intentional host policy pending PS5 console measurement or library disassembly", and the>to>=change has no stated source at all. Before this PR a pointer to zero waited indefinitely; after it, the same call returns a timeout. Both cannot be right for a guest that passes 0, and neither is backed by firmware behaviour. If the general behaviour is unknown the project rule is to throw and record it indocs/dev/debt/libkernel.md, not to pick the opposite behaviour and note it as debt. Please cite the firmware disassembly ofsceKernelAioWaitRequests(what it does with*usec == 0), or drop the zero-timeout change.The
>=change is not tied to anything. At exact equality the old code loops once more and the new code returns; no input in the tests distinguishes the two (the new tests all use 0). Either show a test whereelapsed == *usecis observable, or leave the comparison alone.Pull request closed