feat(libkernel): add pipe write events and socket low watermarks to sceKernelAdd*Event #10645

Merged
rocklouis055 merged 10 commits from upstream-pr/10645 into main 2026-11-26 13:10:23 +00:00
rocklouis055 commented 2026-10-24 14:23:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rocklouis055 on 2026-10-24T14:23:28Z.


What

Builds on #9099 (@aarushkha's regular-file events, merged). It extends sceKernelAddReadEvent and sceKernelAddWriteEvent with the two cases kevent already handles and these still throw on:

  • Write end of a pipe: sceKernelAddWriteEvent takes it through GuestSockets::PipeWriteState, with EV_EOF once the read end closes and SCE_KERNEL_ERROR_EPIPE for a new event added after that, as AddDescriptorKnote in Kqueue.cpp does; adding an existing one again succeeds and replaces its udata, as kevent does. A read event on the write end and a write event on the read end still throw, as in kevent.

  • Socket low watermark: a size above 1 on a stream socket becomes the event's lowWater, as NOTE_LOWAT does in kevent (DescriptorLowWater); above 1 on a socket that is not a stream throws, as there. Adding the event again replaces the mark, as ModifyKnote does, and a size above INT64_MAX, which as kn_sdata would be a mark below 1, throws as DescriptorLowWater does. The size stays ignored on pipes, as in kevent, and a size above 1 on a regular file keeps #9099's throw.

  • Datagram size on Windows: GuestSockets::Ready reads a datagram socket's data from an overlapped MSG_PEEK receive, cancelled without waiting if it would pend (its OVERLAPPED, event and buffer stay in a never-freed pool until the kernel completes it), so it reports the next datagram's size as Linux and macOS do; Winsock's FIONREAD reports 1 for a zero-length datagram (traced by @ycbuzi).

The debt entries for these calls are updated: the pipe entry now covers both ends, the socket entry states the low watermark (still above the 1000-character warning it already triggers on main), and a new entry covers the Windows datagram size.

#9823 also edits these lines, replacing NotImplemented_nid_no_patch with throw; it does not add either case.

Order with overlapping PRs

#12296 has merged. The remaining overlap is with @Felipebmaitan's #12682 → #12688 → #12700 stack: both sides add an #include at the same place in Socket/src/Udp.cpp, and nothing else conflicts or calls the other side's code (composed and run on Linux and Windows by @B-Howell). Proposed: this PR first, then that stack, keeping both includes; if its author prefers the reverse, this PR will declare Depends on: #12700 and rebase. Asked here; not yet agreed.

Tested

Linux x86-64 (Ubuntu 26.04, GCC 15), Release, on bf70e27f7d (rebased on main ba8dcc6ae8). guest_socket_events covers: a pipe write event with EV_EOF, EPIPE for a new event after the read end closed and a successful re-add with new udata; stream read marks of 6 and INT64_MAX that time out at 3 bytes, a re-add from INT64_MAX to 1 that fires with data 3 and from 1 to 6 that times out again; a write mark of 64; and a connected loopback datagram socket with an empty queue (times out), a zero-length datagram (data 0), and a zero-length then a 3-byte datagram (data 0, then 3), and a sender and a racing reader on that socket while the read event is polled (every data 0 or 3, then each late datagram read until the event times out). guest_socket_submitted_records checks the peek pool: a submitted record is not handed out again before completion and is reused after it, and a failed event creation is retried on the next acquire. It, guest_equeue_events, guest_kqueue and guest_udp pass 20 times with ctest --repeat until-fail:20. Reverting the re-add mark update, or returning EPIPE on every re-add, makes guest_socket_events abort. The Windows Udp.cpp passes a syntax check with clang for x86_64-windows-gnu (no diagnostics in the new code), and @ycbuzi ran 8e19a7affc on Windows (the four tests pass; with only main's Udp.cpp the zero-length datagram check fails), and @B-Howell ran b1d851bf47 on Windows 11 and WSL2 (the seven socket and event tests pass 3 of 3; with main's Equeue.cpp and Udp.cpp, guest_socket_events aborts); @tkcm01 ran b1d851bf47 on macOS (Apple M4, x86_64 under Rosetta 2): guest_socket_events passes 30/30 and guest_socket_submitted_records 5/5, and with only this PR's tests guest_socket_events aborts on the missing low watermark. The pipe write-event cases are skipped there, since the pipe write state throws on macOS, as for kevent.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4996200398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10645). Originally posted by [rocklouis055](https://github.com/rocklouis055) on 2026-10-24T14:23:28Z. --- ### What Builds on #9099 (@aarushkha's regular-file events, merged). It extends `sceKernelAddReadEvent` and `sceKernelAddWriteEvent` with the two cases `kevent` already handles and these still throw on: - **Write end of a pipe**: `sceKernelAddWriteEvent` takes it through `GuestSockets::PipeWriteState`, with `EV_EOF` once the read end closes and `SCE_KERNEL_ERROR_EPIPE` for a new event added after that, as `AddDescriptorKnote` in `Kqueue.cpp` does; adding an existing one again succeeds and replaces its `udata`, as `kevent` does. A read event on the write end and a write event on the read end still throw, as in `kevent`. - **Socket low watermark**: a `size` above 1 on a stream socket becomes the event's `lowWater`, as `NOTE_LOWAT` does in `kevent` (`DescriptorLowWater`); above 1 on a socket that is not a stream throws, as there. Adding the event again replaces the mark, as `ModifyKnote` does, and a size above `INT64_MAX`, which as `kn_sdata` would be a mark below 1, throws as `DescriptorLowWater` does. The size stays ignored on pipes, as in `kevent`, and a size above 1 on a regular file keeps #9099's throw. - **Datagram size on Windows**: `GuestSockets::Ready` reads a datagram socket's `data` from an overlapped `MSG_PEEK` receive, cancelled without waiting if it would pend (its `OVERLAPPED`, event and buffer stay in a never-freed pool until the kernel completes it), so it reports the next datagram's size as Linux and macOS do; Winsock's `FIONREAD` reports 1 for a zero-length datagram (traced by @ycbuzi). The debt entries for these calls are updated: the pipe entry now covers both ends, the socket entry states the low watermark (still above the 1000-character warning it already triggers on `main`), and a new entry covers the Windows datagram size. #9823 also edits these lines, replacing `NotImplemented_nid_no_patch` with `throw`; it does not add either case. ### Order with overlapping PRs #12296 has merged. The remaining overlap is with @Felipebmaitan's #12682 → #12688 → #12700 stack: both sides add an `#include` at the same place in `Socket/src/Udp.cpp`, and nothing else conflicts or calls the other side's code ([composed and run on Linux and Windows by @B-Howell](https://github.com/boykopovar/AnyPS5/pull/10645#issuecomment-6586777672)). Proposed: this PR first, then that stack, keeping both includes; if its author prefers the reverse, this PR will declare `Depends on: #12700` and rebase. [Asked here](https://github.com/boykopovar/AnyPS5/pull/10645#issuecomment-6603548744); not yet agreed. ### Tested Linux x86-64 (Ubuntu 26.04, GCC 15), Release, on `bf70e27f7d` (rebased on `main` `ba8dcc6ae8`). `guest_socket_events` covers: a pipe write event with `EV_EOF`, `EPIPE` for a new event after the read end closed and a successful re-add with new `udata`; stream read marks of 6 and `INT64_MAX` that time out at 3 bytes, a re-add from `INT64_MAX` to 1 that fires with `data` 3 and from 1 to 6 that times out again; a write mark of 64; and a connected loopback datagram socket with an empty queue (times out), a zero-length datagram (`data` 0), and a zero-length then a 3-byte datagram (`data` 0, then 3), and a sender and a racing reader on that socket while the read event is polled (every `data` 0 or 3, then each late datagram read until the event times out). `guest_socket_submitted_records` checks the peek pool: a submitted record is not handed out again before completion and is reused after it, and a failed event creation is retried on the next acquire. It, `guest_equeue_events`, `guest_kqueue` and `guest_udp` pass 20 times with `ctest --repeat until-fail:20`. Reverting the re-add mark update, or returning `EPIPE` on every re-add, makes `guest_socket_events` abort. The Windows `Udp.cpp` passes a syntax check with clang for `x86_64-windows-gnu` (no diagnostics in the new code), and @ycbuzi ran `8e19a7affc` on Windows (the four tests pass; with only `main`'s `Udp.cpp` the zero-length datagram check fails), and @B-Howell ran `b1d851bf47` on Windows 11 and WSL2 (the seven socket and event tests pass 3 of 3; with `main`'s `Equeue.cpp` and `Udp.cpp`, `guest_socket_events` aborts); @tkcm01 ran `b1d851bf47` on macOS (Apple M4, x86_64 under Rosetta 2): `guest_socket_events` passes 30/30 and `guest_socket_submitted_records` 5/5, and with only this PR's tests `guest_socket_events` aborts on the missing low watermark. The pipe write-event cases are skipped there, since the pipe write state throws on macOS, as for `kevent`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-24 14:31:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T14:31:53Z.

Review: APPROVED


Reviewed the exact head e673953786a79b3252b673438e45956daad61253. The added pipe-write path matches kevent handling for writable readiness, EV_EOF, and EPIPE after the read end closes; the low-watermark path uses the same stream-socket restriction and poll threshold as DescriptorLowWater. The added tests exercise both wrong pipe ends, closed-reader behavior, stream thresholds, and rejection on datagram sockets. The hosted conventions check passes, with the existing overlong debt-entry warning; the repository-local convention check reports the same warning and no errors. The PR correctly declares its dependency on #9099, which remains open. I did not independently run the product build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638605100 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10645#pullrequestreview-5638605100). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T14:31:53Z. **Review:** APPROVED --- Reviewed the exact head `e673953786a79b3252b673438e45956daad61253`. The added pipe-write path matches `kevent` handling for writable readiness, `EV_EOF`, and `EPIPE` after the read end closes; the low-watermark path uses the same stream-socket restriction and poll threshold as `DescriptorLowWater`. The added tests exercise both wrong pipe ends, closed-reader behavior, stream thresholds, and rejection on datagram sockets. The hosted conventions check passes, with the existing overlong debt-entry warning; the repository-local convention check reports the same warning and no errors. The PR correctly declares its dependency on #9099, which remains open. I did not independently run the product build.
ahmadmuj commented 2026-10-25 16:26:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T16:26:18Z.

Review: COMMENTED


Reviewed head 84da0e33070c merged onto main 0119103fa9ed (clean merge), Linux x86-64 (WSL2 Ubuntu 24.04, GCC 13.3), Release.

What I ran:

  • guest_socket_events on the merge: passes, 20/20 with --repeat until-fail:20. guest_equeue_events and guest_kqueue pass too.
  • Controls with this PR's test: main's Equeue.cpp aborts with sceKernelAddWriteEvent: descriptor that is neither a socket nor a regular file not implemented; the 54ffdb28c5 assignment (watermark for every size) fails (hangs to the 20 s ctest timeout); an unchecked static_cast<std::int64_t>(size) aborts. So the new checks catch all three.

Two things I think are worth fixing, one minor:

  1. Re-adding a socket event keeps the old watermark. AddDescriptorEvent passes the new lowWater to KernelEqueuePrivate::AddEvent, but for an event that already exists that only updates deadline, interval and udata (Equeue.cpp:475-477). kevent goes through ModifyKnote, which replaces lowWater (Kqueue.cpp:415), matching the kevent debt entry ("a later change of the knote replaces it as kqueue_register replaces kn_sdata"). Before this PR the mark was always 0 on this path, so this is new. Probe on the merge, stream socket with 3 bytes queued:

    • sceKernelAddReadEvent(eq, reader, 6, …) then sceKernelAddReadEvent(eq, reader, 1, …): the wait times out (mark is still 6)
    • size 1 then size 6: the event fires with data 3 (mark is still 1)

    Updating lowWater for an existing socket event (as ModifyKnote does) fixes it, and an add-6-then-add-1 check would cover it.

  2. Sizes above INT64_MAX are capped, where kevent throws. DescriptorLowWater throws on a NOTE_LOWAT mark below 1 (Kqueue.cpp:167), and a size above INT64_MAX is exactly such a negative mark if it reaches kn_sdata the way this PR models it. The kevent measurements entry also records the console firing at once for a mark of -1 on a drained stream socket. So under the PR's own model sceKernelAddReadEvent(eq, s, SIZE_MAX, …) would fire at once on the console, while here it never fires short of EOF. Throwing for those sizes, as kevent does, fits the throw-on-unknown rule better than picking a behaviour. The INT64_MAX + 1 and SIZE_MAX checks would then become Rejects-style or go away.

  3. Minor: a write event re-added on a pipe after the read end closed returns EPIPE (Equeue.cpp:836 runs before the existing-event lookup) and keeps the old udata. kevent checks EPIPE only for a new knote (Kqueue.cpp:475 to AddDescriptorKnote), as FreeBSD 11.4 runs pipe_kqfilter only on attach. Example: sceKernelAddWriteEvent(eq, p[1], 1, a), close(p[0]), sceKernelAddWriteEvent(eq, p[1], 1, b) gives EPIPE here and success through kevent. (Read from the code, not run.)

Not run: Windows, macOS.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644124220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10645#pullrequestreview-5644124220). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T16:26:18Z. **Review:** COMMENTED --- Reviewed head `84da0e33070c` merged onto `main` `0119103fa9ed` (clean merge), Linux x86-64 (WSL2 Ubuntu 24.04, GCC 13.3), Release. What I ran: - `guest_socket_events` on the merge: passes, 20/20 with `--repeat until-fail:20`. `guest_equeue_events` and `guest_kqueue` pass too. - Controls with this PR's test: main's `Equeue.cpp` aborts with `sceKernelAddWriteEvent: descriptor that is neither a socket nor a regular file not implemented`; the `54ffdb28c5` assignment (watermark for every size) fails (hangs to the 20 s ctest timeout); an unchecked `static_cast<std::int64_t>(size)` aborts. So the new checks catch all three. Two things I think are worth fixing, one minor: 1. **Re-adding a socket event keeps the old watermark.** `AddDescriptorEvent` passes the new `lowWater` to `KernelEqueuePrivate::AddEvent`, but for an event that already exists that only updates deadline, interval and udata (Equeue.cpp:475-477). kevent goes through `ModifyKnote`, which replaces `lowWater` (Kqueue.cpp:415), matching the kevent debt entry ("a later change of the knote replaces it as `kqueue_register` replaces `kn_sdata`"). Before this PR the mark was always 0 on this path, so this is new. Probe on the merge, stream socket with 3 bytes queued: - `sceKernelAddReadEvent(eq, reader, 6, …)` then `sceKernelAddReadEvent(eq, reader, 1, …)`: the wait times out (mark is still 6) - size 1 then size 6: the event fires with `data` 3 (mark is still 1) Updating `lowWater` for an existing socket event (as `ModifyKnote` does) fixes it, and an add-6-then-add-1 check would cover it. 2. **Sizes above `INT64_MAX` are capped, where kevent throws.** `DescriptorLowWater` throws on a `NOTE_LOWAT` mark below 1 (Kqueue.cpp:167), and a size above `INT64_MAX` is exactly such a negative mark if it reaches `kn_sdata` the way this PR models it. The kevent measurements entry also records the console firing at once for a mark of -1 on a drained stream socket. So under the PR's own model `sceKernelAddReadEvent(eq, s, SIZE_MAX, …)` would fire at once on the console, while here it never fires short of EOF. Throwing for those sizes, as kevent does, fits the throw-on-unknown rule better than picking a behaviour. The `INT64_MAX + 1` and `SIZE_MAX` checks would then become `Rejects`-style or go away. 3. Minor: a write event re-added on a pipe after the read end closed returns `EPIPE` (Equeue.cpp:836 runs before the existing-event lookup) and keeps the old udata. kevent checks `EPIPE` only for a new knote (Kqueue.cpp:475 to `AddDescriptorKnote`), as FreeBSD 11.4 runs `pipe_kqfilter` only on attach. Example: `sceKernelAddWriteEvent(eq, p[1], 1, a)`, `close(p[0])`, `sceKernelAddWriteEvent(eq, p[1], 1, b)` gives `EPIPE` here and success through `kevent`. (Read from the code, not run.) Not run: Windows, macOS.
MarcZX10 commented 2026-10-29 05:41:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:41:49Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The current implementation still needs a deterministic event test and an explicit integration order with the newer socket work. The latest macOS run of head 459808d639 reports guest_socket_events aborting in 5 of 6 runs at the ETIMEDOUT check after the racing sender and reader join; the probe found a datagram still queued on the failing runs. This is a platform-specific test failure that needs to be resolved or isolated with a supported deterministic test before relying on the suite.

The current heads also conflict when composed: #10645 with #12688 conflicts in Udp.cpp and the kernel debt file; #10645 with #12700 has the same conflicts. #12688/#12700 are part of the replacement transport/write stack, so the earlier #11872 order needs to be reconsidered against those current heads.

What I ran

  • Reviewed exact head 459808d639d933e070dd37115367317657461313 against current main 52c09d567d2fa453494dd720fcf53a98149468e4.
  • Ran a current-main merge preview and git diff --check.
  • Ran pairwise git merge-tree --write-tree previews for #10645 with #12688 and #12700.
  • Checked the exact-head macOS test report, the prior Linux report, and current hosted checks.

Results

Check Result
Current-main merge preview Clean
Pairwise integration with #12688 Conflicts in Udp.cpp and docs/dev/debt/libkernel.md
Pairwise integration with #12700 Conflicts in Udp.cpp and docs/dev/debt/libkernel.md
macOS guest_socket_events Author/reviewer report: 5 of 6 runs abort at the timeout assertion; a datagram remained queued in the failing runs
Current hosted product tests Skipped; the Windows job is also skipped on this head

Please stabilize the macOS event test and coordinate an order with the authors of the overlapping socket changes, then record the agreed dependencies and rerun focused event/datagram tests on the integrated head. I have no preferred order based on the current evidence and am not asking anyone to close or abandon work.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693358004 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10645#pullrequestreview-5693358004). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T05:41:49Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested The current implementation still needs a deterministic event test and an explicit integration order with the newer socket work. The latest macOS run of head `459808d639` reports `guest_socket_events` aborting in 5 of 6 runs at the `ETIMEDOUT` check after the racing sender and reader join; the probe found a datagram still queued on the failing runs. This is a platform-specific test failure that needs to be resolved or isolated with a supported deterministic test before relying on the suite. The current heads also conflict when composed: #10645 with #12688 conflicts in `Udp.cpp` and the kernel debt file; #10645 with #12700 has the same conflicts. #12688/#12700 are part of the replacement transport/write stack, so the earlier #11872 order needs to be reconsidered against those current heads. ## What I ran - Reviewed exact head `459808d639d933e070dd37115367317657461313` against current `main` `52c09d567d2fa453494dd720fcf53a98149468e4`. - Ran a current-main merge preview and `git diff --check`. - Ran pairwise `git merge-tree --write-tree` previews for #10645 with #12688 and #12700. - Checked the exact-head macOS test report, the prior Linux report, and current hosted checks. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | Pairwise integration with #12688 | Conflicts in `Udp.cpp` and `docs/dev/debt/libkernel.md` | | Pairwise integration with #12700 | Conflicts in `Udp.cpp` and `docs/dev/debt/libkernel.md` | | macOS `guest_socket_events` | Author/reviewer report: 5 of 6 runs abort at the timeout assertion; a datagram remained queued in the failing runs | | Current hosted product tests | Skipped; the Windows job is also skipped on this head | Please stabilize the macOS event test and coordinate an order with the authors of the overlapping socket changes, then record the agreed dependencies and rerun focused event/datagram tests on the integrated head. I have no preferred order based on the current evidence and am not asking anyone to close or abandon work.
MarcZX10 commented 2026-11-01 11:07:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T11:07:08Z.

Review: COMMENTED


Re-checked — new head, no blocking findings

The new head changes only the final check after the racing threads join, and I found no blocking defect, but that check no longer fails when a datagram stays queued without an event, which was the symptom the earlier changes-requested review cited.

What I ran

Exact head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9, previously reviewed head 459808d639d933e070dd37115367317657461313, current main e67cc818696fd6e6c58ac80adc6550c54aed68e8 (merge preview clean, no declared dependencies). Environment: Debian 12, Python 3.11.2, git 2.39.5. No build, no compiler, no CTest.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10645
python3 tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5
git diff 2742004ed28f765c7147db0e0269ff5868e9eb6f 459808d639d933e070dd37115367317657461313 -- <7 PR files>
git diff ba8dcc6ae82a5c4443efd93bbb99dfa91faf7fa4 bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 -- <7 PR files>
python3 tools/pr_abi_audit.py --repo <local clone> --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 --json
python3 tools/pr_test_quality.py --root <git archive of the head> --json core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp

The precheck's ABI and test-quality helpers could not find their scripts in its isolated head tree, so I ran both helpers by hand as listed. The changed-line comparison was run on the PR's own patches at both heads.

Results

Check Result
Conventions and PR template (precheck) Passed.
git diff --check (precheck) Passed.
Live stack and merge preview against main (precheck) Clean.
Changed lines, old head vs new head Only one hunk differs: the final check in core/libs/tests/GuestSocketEvents.cpp. The product files (Equeue.cpp, Udp.cpp, SubmittedRecords.hpp, libkernel CMakeLists.txt) have identical changed lines at both heads.
pr_abi_audit.py (by hand) Passed: 58 symbols, 0 findings.
pr_test_quality.py (by hand) Two heuristic findings, both possible-unregistered-cpp-test. Both files are registered in core/libs/prx/libkernel/CMakeLists.txt through ${LIBS_INCLUDE_DIR}/tests/... paths, so these are false positives.
Hosted CI (precheck snapshot) Passed: conventions, library-portability, report, eligibility. Pending: labels, windows. Skipped: linux, register-context, relinker, relinker-asan, write-watch.
Build, CTest, macOS Not run.
Unedited command output
$ python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 --json
status: passed; symbols: 58; findings: []

$ python3 tools/pr_test_quality.py --root <archive> --json core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp
findings: possible-unregistered-cpp-test (core/libs/tests/GuestSocketEvents.cpp, line 1)
findings: possible-unregistered-cpp-test (core/libs/tests/GuestSocketSubmittedRecords.cpp, line 1)

changed-line diff (old head vs new head, PR files only):
< +    Require(sceKernelWaitEqueue(blocking, events.data(), events.size(), &count, &shortTimeout) == SCE_KERNEL_ERROR_ETIMEDOUT);
> +    char late[8];
> +    int drained = SCE_OK;
> +    while ((drained = sceKernelWaitEqueue(blocking, events.data(), events.size(), &count, &shortTimeout)) == SCE_OK) {
> +        Require(count == 1 && (events[0].data == 0 || events[0].data == 3));
> +        Require(recv_nid_postfix(datagram, late, sizeof(late), 0x80) == events[0].data);
> +    }
> +    Require(drained == SCE_KERNEL_ERROR_ETIMEDOUT);

Findings

Blocking: None.

Non-blocking:

  • At the earlier head, the test asserted a single timeout after the racing threads joined, so any event for a queued datagram failed the test. At the new head, the loop at lines 361-364 drains each event and exits on the first timeout. If a datagram stays queued and no event is reported, the test now passes without checking the queue. The racing reader already relies on a negative recv with flag 0x80 meaning "empty", so an emptiness check can use the same convention. Suggested addition after line 365:
    Require(drained == SCE_KERNEL_ERROR_ETIMEDOUT);
    Require(recv_nid_postfix(datagram, late, sizeof(late), 0x80) < 0);

Sources

Not verified

  • The Linux repeats the author reports (20 runs of the event suite on the rebuilt tree) and the hosted Linux job, which is skipped on this head, were not run or re-checked here.
  • macOS was not run. The rerun on bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 that the description requests is still needed; this review cannot provide it.
  • The merge order proposed in the PR description is a maintainer decision and is not answered by this review.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5727746294 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10645#pullrequestreview-5727746294). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T11:07:08Z. **Review:** COMMENTED --- # Re-checked — new head, no blocking findings The new head changes only the final check after the racing threads join, and I found no blocking defect, but that check no longer fails when a datagram stays queued without an event, which was the symptom the earlier changes-requested review cited. ## What I ran Exact head `bf70e27f7db6fe20e56d788ee44c0de1c9266ed9`, previously reviewed head `459808d639d933e070dd37115367317657461313`, current `main` `e67cc818696fd6e6c58ac80adc6550c54aed68e8` (merge preview clean, no declared dependencies). Environment: Debian 12, Python 3.11.2, git 2.39.5. No build, no compiler, no CTest. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10645 python3 tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5 git diff 2742004ed28f765c7147db0e0269ff5868e9eb6f 459808d639d933e070dd37115367317657461313 -- <7 PR files> git diff ba8dcc6ae82a5c4443efd93bbb99dfa91faf7fa4 bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 -- <7 PR files> python3 tools/pr_abi_audit.py --repo <local clone> --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 --json python3 tools/pr_test_quality.py --root <git archive of the head> --json core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp ``` The precheck's ABI and test-quality helpers could not find their scripts in its isolated head tree, so I ran both helpers by hand as listed. The changed-line comparison was run on the PR's own patches at both heads. ## Results | Check | Result | |---|---| | Conventions and PR template (precheck) | Passed. | | `git diff --check` (precheck) | Passed. | | Live stack and merge preview against `main` (precheck) | Clean. | | Changed lines, old head vs new head | Only one hunk differs: the final check in `core/libs/tests/GuestSocketEvents.cpp`. The product files (`Equeue.cpp`, `Udp.cpp`, `SubmittedRecords.hpp`, libkernel `CMakeLists.txt`) have identical changed lines at both heads. | | `pr_abi_audit.py` (by hand) | Passed: 58 symbols, 0 findings. | | `pr_test_quality.py` (by hand) | Two heuristic findings, both `possible-unregistered-cpp-test`. Both files are registered in `core/libs/prx/libkernel/CMakeLists.txt` through `${LIBS_INCLUDE_DIR}/tests/...` paths, so these are false positives. | | Hosted CI (precheck snapshot) | Passed: conventions, library-portability, report, eligibility. Pending: labels, windows. Skipped: linux, register-context, relinker, relinker-asan, write-watch. | | Build, CTest, macOS | Not run. | <details><summary>Unedited command output</summary> ```text $ python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 --json status: passed; symbols: 58; findings: [] $ python3 tools/pr_test_quality.py --root <archive> --json core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp findings: possible-unregistered-cpp-test (core/libs/tests/GuestSocketEvents.cpp, line 1) findings: possible-unregistered-cpp-test (core/libs/tests/GuestSocketSubmittedRecords.cpp, line 1) changed-line diff (old head vs new head, PR files only): < + Require(sceKernelWaitEqueue(blocking, events.data(), events.size(), &count, &shortTimeout) == SCE_KERNEL_ERROR_ETIMEDOUT); > + char late[8]; > + int drained = SCE_OK; > + while ((drained = sceKernelWaitEqueue(blocking, events.data(), events.size(), &count, &shortTimeout)) == SCE_OK) { > + Require(count == 1 && (events[0].data == 0 || events[0].data == 3)); > + Require(recv_nid_postfix(datagram, late, sizeof(late), 0x80) == events[0].data); > + } > + Require(drained == SCE_KERNEL_ERROR_ETIMEDOUT); ``` </details> ## Findings **Blocking:** None. **Non-blocking:** - At the earlier head, the test asserted a single timeout after the racing threads joined, so any event for a queued datagram failed the test. At the new head, the loop at lines 361-364 drains each event and exits on the first timeout. If a datagram stays queued and no event is reported, the test now passes without checking the queue. The racing reader already relies on a negative `recv` with flag `0x80` meaning "empty", so an emptiness check can use the same convention. Suggested addition after line 365: ```cpp Require(drained == SCE_KERNEL_ERROR_ETIMEDOUT); Require(recv_nid_postfix(datagram, late, sizeof(late), 0x80) < 0); ``` ## Sources - [Final drain check at the new head](https://github.com/boykopovar/AnyPS5/blob/bf70e27f7db6fe20e56d788ee44c0de1c9266ed9/core/libs/tests/GuestSocketEvents.cpp#L358-L365) - [Racing reader's `recv` loop at the new head](https://github.com/boykopovar/AnyPS5/blob/bf70e27f7db6fe20e56d788ee44c0de1c9266ed9/core/libs/tests/GuestSocketEvents.cpp#L343-L350) - [Single-timeout check at the previous head](https://github.com/boykopovar/AnyPS5/blob/459808d639d933e070dd37115367317657461313/core/libs/tests/GuestSocketEvents.cpp#L327) ## Not verified - The Linux repeats the author reports (20 runs of the event suite on the rebuilt tree) and the hosted Linux job, which is skipped on this head, were not run or re-checked here. - macOS was not run. The rerun on `bf70e27f7db6fe20e56d788ee44c0de1c9266ed9` that the description requests is still needed; this review cannot provide it. - The merge order proposed in the PR description is a maintainer decision and is not answered by this review.
MarcZX10 commented 2026-11-01 16:22:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T16:22:28Z.

Review: DISMISSED


Re-checked — new head, changes requested

The new head adds the missing final queue-empty assertion, but the required merge order with three open overlapping PRs is still explicitly unagreed.

What I ran

Reviewed head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1, based on e6f57307fa7f47165d7fc1bee945abdb2f6816e7; the live preview onto current main f2d874c1fdccf781c0fa5d86619bb5dd8894b958 is clean. Environment: Debian 12 x86-64, Python 3.11.2, Git 2.39.5. No compiler or build was run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10645
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/head-b1d851bf4752-41251437 core/libs/prx/libkernel/CMakeLists.txt core/libs/prx/libkernel/Equeue/Equeue.cpp core/libs/prx/libkernel/Socket/include/SubmittedRecords.hpp core/libs/prx/libkernel/Socket/src/Udp.cpp core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp docs/dev/debt/libkernel.md
git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...b1d851bf4752c6cb42f4aba29bc4004fbd666ba1
python3 tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5
git show b1d851bf4752c6cb42f4aba29bc4004fbd666ba1:core/libs/prx/libkernel/CMakeLists.txt | grep -n -A18 'add_test_executable(guest_socket_event_tests'

Results

Check Result Note
Patch and conventions passed One existing debt-entry length warning.
Export/NID audit passed 58 symbols; no findings.
Test registration passed Both added C++ tests are in CMake.
Test-quality heuristic passed Two unregistered-test warnings are false positives; CMake uses ${LIBS_INCLUDE_DIR} paths.
Current-main merge preview passed Clean against current main.
Hosted checks passed Windows and required metadata checks pass; Linux and specialized jobs were skipped.
C++ tests on this head not run No exact-head build was performed.
Selected raw check output
# PR precheck report — checks failed
Head unchanged at completion: **True**
Base unchanged at completion: **True**

| Check | Status | Command / reason |
|---|---|---|
| diff_check | passed | `git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...b1d851bf4752c6cb42f4aba29bc4004fbd666ba1` |
| conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1 --title feat(libkernel): add pipe write events and socket low watermarks to sceKernelAdd*Event --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/pr-body.md` |
| changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py ...`; script absent from detached snapshot |
| live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/stack` |
| test_quality_heuristics | failed | Script absent from detached snapshot |

Manual rerun:
ABI audit: passed

core/libs/tests/GuestSocketEvents.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
core/libs/tests/GuestSocketSubmittedRecords.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.

Target branch tip: `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`
All heads unchanged: **True**
Dependency order: #10645
- PR #10645: **clean** against current base; head `b1d851bf4752c6cb42f4aba29bc4004fbd666ba1`
No declared PR dependencies were found in the target PR chain.

Negative control

Assertion Code change Result
The datagram queue is empty after the final equeue timeout. Author reports sending an extra datagram before the assertion. Author reports the test fails; I did not independently run this control.

Findings

Blocking

  • The PR proposes landing before #12682, #12688 and #12700, but says this order is “Not yet agreed.” Those PRs remain open, and the transport PR records an overlapping Udp.cpp seam with #10645 and says the second PR must rebase. The repository requires overlapping authors to agree on order and declare it with Depends on. Please coordinate the order with the affected authors and update the PR order/dependency declaration to reflect that agreement.

Non-blocking

  • The reported macOS rerun is still outstanding on this head. The earlier macOS failure was reported against an older head; Windows CI passes, but this does not verify the macOS case.

Sources

Not verified

No local build, CTest, macOS rerun, or console behavior was verified. The negative control is author-reported only.

To get this to a good state

Please reach and record an order agreement with the overlapping PR authors, then update the relevant Depends on declarations. I will rerun the same no-build checks on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729042250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10645#pullrequestreview-5729042250). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T16:22:28Z. **Review:** DISMISSED --- # Re-checked — new head, changes requested The new head adds the missing final queue-empty assertion, but the required merge order with three open overlapping PRs is still explicitly unagreed. ## What I ran Reviewed head `b1d851bf4752c6cb42f4aba29bc4004fbd666ba1`, based on `e6f57307fa7f47165d7fc1bee945abdb2f6816e7`; the live preview onto current `main` `f2d874c1fdccf781c0fa5d86619bb5dd8894b958` is clean. Environment: Debian 12 x86-64, Python 3.11.2, Git 2.39.5. No compiler or build was run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10645 python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1 python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/head-b1d851bf4752-41251437 core/libs/prx/libkernel/CMakeLists.txt core/libs/prx/libkernel/Equeue/Equeue.cpp core/libs/prx/libkernel/Socket/include/SubmittedRecords.hpp core/libs/prx/libkernel/Socket/src/Udp.cpp core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp docs/dev/debt/libkernel.md git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...b1d851bf4752c6cb42f4aba29bc4004fbd666ba1 python3 tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5 git show b1d851bf4752c6cb42f4aba29bc4004fbd666ba1:core/libs/prx/libkernel/CMakeLists.txt | grep -n -A18 'add_test_executable(guest_socket_event_tests' ``` ## Results | Check | Result | Note | |---|---|---| | Patch and conventions | passed | One existing debt-entry length warning. | | Export/NID audit | passed | 58 symbols; no findings. | | Test registration | passed | Both added C++ tests are in CMake. | | Test-quality heuristic | passed | Two unregistered-test warnings are false positives; CMake uses `${LIBS_INCLUDE_DIR}` paths. | | Current-main merge preview | passed | Clean against current `main`. | | Hosted checks | passed | Windows and required metadata checks pass; Linux and specialized jobs were skipped. | | C++ tests on this head | not run | No exact-head build was performed. | <details> <summary>Selected raw check output</summary> ```text # PR precheck report — checks failed Head unchanged at completion: **True** Base unchanged at completion: **True** | Check | Status | Command / reason | |---|---|---| | diff_check | passed | `git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...b1d851bf4752c6cb42f4aba29bc4004fbd666ba1` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1 --title feat(libkernel): add pipe write events and socket low watermarks to sceKernelAdd*Event --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py ...`; script absent from detached snapshot | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/stack` | | test_quality_heuristics | failed | Script absent from detached snapshot | Manual rerun: ABI audit: passed core/libs/tests/GuestSocketEvents.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage. core/libs/tests/GuestSocketSubmittedRecords.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage. Heuristic findings require manual interpretation. Target branch tip: `f2d874c1fdccf781c0fa5d86619bb5dd8894b958` All heads unchanged: **True** Dependency order: #10645 - PR #10645: **clean** against current base; head `b1d851bf4752c6cb42f4aba29bc4004fbd666ba1` No declared PR dependencies were found in the target PR chain. ``` </details> ## Negative control | Assertion | Code change | Result | |---|---|---| | The datagram queue is empty after the final equeue timeout. | Author reports sending an extra datagram before the assertion. | Author reports the test fails; I did not independently run this control. | ## Findings **Blocking** - The PR proposes landing before #12682, #12688 and #12700, but says this order is “Not yet agreed.” Those PRs remain open, and the transport PR records an overlapping `Udp.cpp` seam with #10645 and says the second PR must rebase. The repository requires overlapping authors to agree on order and declare it with `Depends on`. Please coordinate the order with the affected authors and update the PR order/dependency declaration to reflect that agreement. **Non-blocking** - The reported macOS rerun is still outstanding on this head. The earlier macOS failure was reported against an older head; Windows CI passes, but this does not verify the macOS case. ## Sources - [Contribution rule at current main](https://github.com/boykopovar/AnyPS5/blob/f2d874c1fdccf781c0fa5d86619bb5dd8894b958/CONTRIBUTING.md#L71) - [Final queue assertion at this head](https://github.com/boykopovar/AnyPS5/blob/b1d851bf4752c6cb42f4aba29bc4004fbd666ba1/core/libs/tests/GuestSocketEvents.cpp#L358-L368) - [CMake registration at this head](https://github.com/boykopovar/AnyPS5/blob/b1d851bf4752c6cb42f4aba29bc4004fbd666ba1/core/libs/prx/libkernel/CMakeLists.txt#L1853-L1871) - [Transport PR overlap comment](https://github.com/boykopovar/AnyPS5/pull/12688#issuecomment-6488661727) - [Author-reported Linux negative control](https://github.com/boykopovar/AnyPS5/pull/10645#issuecomment-6557759689) ## Not verified No local build, CTest, macOS rerun, or console behavior was verified. The negative control is author-reported only. ## To get this to a good state Please reach and record an order agreement with the overlapping PR authors, then update the relevant `Depends on` declarations. I will rerun the same no-build checks on the new head.
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!10645
No description provided.