fix(libkernel): bound the raise wait on host code to 50 ms #8512
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8512"
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 oneandonlydean on 2026-10-20T14:22:52Z.
Follow-up to #7652.
What
A raise on a thread that is running host code waited up to the 1 s
RetryLimitfor the thread to reach guest code before falling back. Windowsguest_raise_exceptionraises against targets that loop in HLE libraries, the CRT and kernelbase about 110 times since #8390 halved its rounds (about 220 before), so the lane takes 18-20 s on currentmainagainst about 7.5 s for the same rounds before #7652, and it timed out at 30 s before #8390 (6 of 10 runs on bases containing437de6392f).Host code now has its own
HostCodeLimitof 50 ms. The raise breaks out and redirects in place once the target has been seen in host code past that deadline. The 1 sRetryLimitis unchanged for a target inside NtContinue or winpthreads (the throw). The #7652 fix stays: a guest window comes around far more often than every 50 ms inguest_raise_in_host_code, and a short host call such as the stderr write is the case the 50 ms covers.Linux is unaffected: the change is inside
#ifdef _WIN32.Tested
No Windows host here, so this is not measured locally. Needed from CI (3 full runs): Windows
guest_raise_exceptionat about 8-13 s (about 7.5 s plus at most 110 × 50 ms of host-code waits) with every run under 20 s and no timeout;guest_raise_in_host_code,guest_raise_nested_sleepandguest_mutex_raise_exceptionPassed.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)guest_raise_exceptionon mainImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T14:32:48Z.
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/System/src/Exception.cppL394-396core/libs/prx/libkernel/System/src/Exception.cppL194, L396, L426Some 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/System/src/Exception.cppcore/libs/prx/libkernel/System/src/Exception.cppcore/libs/prx/libkernel/System/src/Exception.cpp