fix(libkernel): report a level-triggered equeue event once per wait #2703
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2703"
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 husseinkad on 2026-10-10T11:35:11Z.
What
An event added with
sceKernelAddUserEventhas noEV_CLEAR, so it stays triggered until it is deleted. The collection loop inEqueue.cppkept re-emitting it until the caller's buffer was full: asceKernelWaitEqueuecall withnum= 4 on one level event returned count 4, all the same event. kqueue examines a knote once per scan and re-queues a reported level knote behind the scan marker for the next call (kqueue_scaninsys/kern/kern_event.c;kevent(2): "multiple events which trigger the filter do not result in multiple kevents being placed on the kqueue"), so a level event is reported at most once per call and again on the next one.The two copies of the collection loop (
GetTriggeredEventsandWaitForEvents) are now oneCollectTriggered. It only stays on the same event when a distinct queued completion follows, which the AMPR and VideoOut events rely on. Timers, HR timers andEV_CLEARevents behave as before. The Orbis behaviour was not measured on a console; that, the remaining starvation of later events whennumis smaller than the number of ready level events (FreeBSD rotates them), and AMPR/VideoOut completions being returned as separate entries are recorded in TechnicalDebt.Tested
Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release:
guest_equeue_eventsgains: a level event reported once per call withnum= 4 on the poll path and on a blocking wait with a 1 s timeout (also when a helper thread triggers it after about 10 ms), an edge event reported once and again after a new trigger, and two AMPR completions of one event delivered in order withnum= 4 and acrossnum= 1 calls. It fails without the change (exit0xc0000409) and passes with it;ctest -R "ampr|equeue"passes.main's and this branch'sEqueue.cpp(N level/edge/mixed events withnumbelow, equal to and above N, one event triggered 50 times between waits, a blocked waiter triggered later, periodic and one-shot timers, 20 AMPR completions on one ident and 3 idents interleaved, deleting an event and the equeue while 4 threads wait, poll/infinite/huge timeouts and bad arguments, and a 4-waiter/4-trigger stress of 3 s): all pass on the branch with no event dropped or duplicated within a call, whilemainfails five of the eight.tools/check_conventions.py --base origin/mainpasses;tools/pr_overlap.py --branchreports no overlap. Open PR #1091 (guest socket events) also editsEqueue.cppandEqueue.hppand conflicts textually; it needs a rebase anyway, and itsPollEvents()call has to stay in the callers beforeCollectTriggered.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 repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T11:35:21Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Pull request closed