libkernel: guest_raise_exception exceeds its 30 s budget on Windows; 14.8 s of it is raises on a thread looping in sceKernelSyncOnAddressWake #9610
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 JJenkx on 2026-10-22T04:15:52Z.
Observed
On
mainatd9c99c9ba4,guest_raise_exceptiontimes out at its 30 sTIMEOUTin most runs on this Windows machine:So the test doesn't hang. It needs more than its budget here, even after
cd2fd50f0chalved its rounds.Where the time goes
I timestamped the test's
RunThreadlines and mapped each thread entry to its function withnm. The run took 34.9 s:HandlerLeavesAddressLock(AddressWaking, …)StartingContinuingSelfingLeavingLockBlocked(3 lock kinds)WaitSemaOnceLoopingHostBlocked,Waiting,Vectors,BusyHandlerLeavesAddressLock(AddressWaiting, …)AddressWakingloops onsceKernelSyncOnAddressWake, so nearly every timesceKernelRaiseExceptionsamples it, the thread is inside a system call. In the Windows delivery loop (System/src/Exception.cpp), each such sample moveshostDeadlinetonow + HostCodeLimit(50 ms), up toRetryLimit(1 s):So delivery waits until a sample happens to land in the thread's short stretch of guest code between two wakes, or until the 1 s limit. That costs about 300 ms per raise here.
AddressWaitingspends its time in a 20 µs timed wait and costs about 11 ms per round. I assume that is because a waiting thread takes thewaitCountAPC path, but I haven't traced it.Open question
Two readings are possible, and the choice belongs to the owners of
681926e085and #8512:AddressRounds(50) or the 30 s budget doesn't fit a scenario that costs up to 1 s per round by design.I haven't changed anything, and I can rerun with any proposed change on this machine.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T13:16:34Z.
I checked the current
mainimplementation (3ca07d086d5f44fbe3c00370e7f03953ab46ca1b). The merged #8512HostCodeLimitdoes not cap thisAddressWakingpath at 50 ms: when the sampled host RIP is inside a system call,RaiseOnextendshostDeadlineby another 50 ms, up to the 1 sretryDeadline(the condition atException.cpparound line 444). That matches the distinction in #8512 between ordinary host code and system-call/throw paths, and is consistent with your measured per-raise delay. The test timeout is still objectively flaky on the reported Windows host. I would keep this open for the named owners to decide whether the wait is required; if it is, the timeout/round count needs to account for that path, while a behavior change needs a Windows regression showing the raise remains safe.