fix(libkernel): report level-triggered equeue events once per wait #3489

Merged
MarcZX10 merged 2 commits from upstream-pr/3489 into main 2026-10-11 11:54:44 +00:00
MarcZX10 commented 2026-10-11 11:33:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T11:33:52Z.


What

Carry Hussein Kadhim's two commits from #3115, preserving the original authorship. A level-triggered user event now appears at most once in each sceKernelWaitEqueue result, while remaining ready for the next wait. The shared collector also preserves distinct queued AMPR completions and honors the caller's event count.

Rebasing the source branch onto current main required resolving its Equeue.cpp overlap with merged #1091. This change keeps #1091's socket polling and descriptor-wait behavior while sharing the event collection logic between polling and blocking paths.

Tested

Linux x86-64, GCC 12.2, Release, BUILD_TESTING=ON: built the equeue, socket-event, AMPR marker/thread, UDP and TCP tests. The following six CTests passed three consecutive runs each:

guest_equeue_events, guest_socket_events, guest_ampr_markers, guest_ampr_threads, guest_udp, guest_tcp.

python3 tools/check_conventions.py --base upstream/main and git diff --check passed. No Windows build or console run was performed here. The source issue reports a Windows 11 test run before the rebase onto current main.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#1091 is merged)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818747190 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3489). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T11:33:52Z. --- ### What Carry Hussein Kadhim's two commits from #3115, preserving the original authorship. A level-triggered user event now appears at most once in each `sceKernelWaitEqueue` result, while remaining ready for the next wait. The shared collector also preserves distinct queued AMPR completions and honors the caller's event count. Rebasing the source branch onto current `main` required resolving its `Equeue.cpp` overlap with merged #1091. This change keeps #1091's socket polling and descriptor-wait behavior while sharing the event collection logic between polling and blocking paths. ### Tested Linux x86-64, GCC 12.2, Release, `BUILD_TESTING=ON`: built the equeue, socket-event, AMPR marker/thread, UDP and TCP tests. The following six CTests passed three consecutive runs each: `guest_equeue_events`, `guest_socket_events`, `guest_ampr_markers`, `guest_ampr_threads`, `guest_udp`, `guest_tcp`. `python3 tools/check_conventions.py --base upstream/main` and `git diff --check` passed. No Windows build or console run was performed here. The source issue reports a Windows 11 test run before the rebase onto current `main`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#1091 is merged) - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-11 11:44:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T11:44:27Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#3396 core/libs/tests/GuestEqueueEvents.cpp L31
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108668540 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3489#issuecomment-6108668540). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T11:44:27Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3396 | `core/libs/tests/GuestEqueueEvents.cpp` [L31](https://github.com/boykopovar/AnyPS5/blob/84f43dcdacd8e81207747919ac38bdd16cfd102f/core/libs/tests/GuestEqueueEvents.cpp#L31) | | |
adriadam10 commented 2026-10-11 11:54:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:54:41Z.


Checked the single-report-per-wait behaviour against FreeBSD kqueue_scan and kevent(2), and the new guest_equeue_events cases (level once per wait in poll and blocking mode, edge, repeated AMPR completions, num limit): they fail without the change and pass with it, together with guest_socket_events, guest_tcp and guest_udp on Linux; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108749031 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3489#issuecomment-6108749031). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:54:41Z. --- Checked the single-report-per-wait behaviour against FreeBSD `kqueue_scan` and kevent(2), and the new `guest_equeue_events` cases (level once per wait in poll and blocking mode, edge, repeated AMPR completions, `num` limit): they fail without the change and pass with it, together with `guest_socket_events`, `guest_tcp` and `guest_udp` on Linux; merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3489
No description provided.