Repository navigation
fix(libkernel): report a level-triggered equeue event once per wait - #2703
Closed
husseinkad wants to merge 2 commits into
Closed
husseinkad wants to merge 2 commits into
husseinkad wants to merge 2 commits into
Conversation
A user event added with sceKernelAddUserEvent stays triggered until it is deleted. The collection loop kept re-emitting it until the caller's event buffer was full, so a wait with num > 1 returned the same event num times. Like kevent, each event is now reported at most once per call; distinct queued completions of one event are still delivered in order.
…vents Document the level-triggered user event semantics of sceKernelWaitEqueue in TechnicalDebt.
|
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. |
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 feat(libkernel): implement read and write events for guest sockets #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 repository