Repository navigation
feat(libkernel): always fire a socket read knote with NOTE_LOWAT below 1 - #14832
adriadam10 merged 2 commits into
Conversation
|
Thanks, the read side matches FreeBSD 11's Please drop the new assertion at Reviewed at |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The low-water update matches the reviewed source and reported PS5 stream-socket behavior; I found no source blocker, and approval is withheld while the label check remains pending.
What I ran
Reviewed head f0a712175fbd7448827b6be896a521d4e36b5040 against base f2d874c1fdccf781c0fa5d86619bb5dd8894b958. The stack preview is clean against current main (e0caf1360035286bd22b9f2a3030e97b880ffb28). Environment: Linux x86_64, Debian 12, Python 3.11.2, Git 2.39.5. No build or C++ tests were run locally.
git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...f0a712175fbd7448827b6be896a521d4e36b5040
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14832
python3 tools/pr_stack_check.py 14832 --repo boykopovar/AnyPS5
gh pr checks 14832 --repo boykopovar/AnyPS5
# Read all five changed files and the pinned FreeBSD references in the PR description.Results
| Check | Result | Note |
|---|---|---|
| Diff whitespace | passed | No whitespace errors |
| Conventions | passed | Two existing debt-length warnings |
| Stack merge preview | passed | Clean against current main |
| Author-reported Windows build and tests | not run | Read from PR description only |
| Hosted Windows build | passed | Linux and specialized jobs skipped |
| Hosted label check | not run | Pending at review time |
| ABI and test-quality helpers | not run | Missing from isolated PR snapshot |
Captured command output
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14832-f0a712175fbd/report.md
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14832-f0a712175fbd/report.json
Conclusion: checks failed
conventions pass 16s https://github.com/boykopovar/AnyPS5/actions/runs/41341836824/job/124953317256
labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41341836892/job/124953317379
windows pass 8m52s https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950260026
linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950261442
register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950262057
relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950261532
relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950262271
write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950262292
eligibility pass 6s https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950221556
intake pass 20s https://github.com/boykopovar/AnyPS5/actions/runs/41340817453/job/124950221653
library-portability pass 1m45s https://github.com/boykopovar/AnyPS5/actions/runs/41340817498/job/124950220434
report pass 50s https://github.com/boykopovar/AnyPS5/actions/runs/41340817510/job/124950220441
Negative control
Not run locally. The PR reports the suite on Windows after the change, but no removed-fix variant was run as a negative control in this review.
Findings
Blocking
None found in the five changed files. The read-side flag is limited to open read sockets with NOTE_LOWAT below 1; edge-triggered modifications rearm the watcher, and listening sockets remain on their separate readiness path. The new tests cover level-triggered and EV_CLEAR cases.
Non-blocking
The PR reports a Windows 11 build and focused tests passing, including the added edge-triggered case; I did not rerun them. The labels check was pending, so this review does not approve the change yet.
Sources
- Low-water implementation at the reviewed head
- New kqueue tests at the reviewed head
- FreeBSD 11.4 read-filter logic at commit
8c639945 - FreeBSD 11.4 socket-buffer availability type at the same commit
Not verified
No local C++ build or runtime test was run. The Windows results and PS5 measurements were read from the PR description, not independently reproduced. Hosted Linux and specialized jobs were skipped, and the label check was still pending.
To get this to a good state
No source change is requested. Once the label check completes, I will refresh the exact head and required checks before deciding whether approval is appropriate.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — hosted checks passed, approved
The exact head is unchanged, the pending labels check has passed, and the hosted Windows build and tests passed; my earlier full review found no blocking source issue.
What I ran
Rechecked head f0a712175fbd7448827b6be896a521d4e36b5040 against base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 using GitHub’s live PR and check state. Environment: Debian 12 x86_64; no local build or compiler run.
gh api repos/boykopovar/AnyPS5/pulls/14832 --jq '{state:.state,head:.head.sha,base:.base.sha}'
gh pr checks 14832 --repo boykopovar/AnyPS5Results
| Check | Result | Note |
|---|---|---|
| Hosted Windows build and tests | passed | Completed on the reviewed head. |
| Conventions, intake, labels, report and portability | passed | Hosted checks completed successfully. |
| Linux and specialized jobs | not applicable | Skipped by workflow. |
| Local build or C++ tests | not run | No local compilation in this follow-up. |
Captured hosted-check output
conventions pass 16s https://github.com/boykopovar/AnyPS5/actions/runs/41341836824/job/124953317256
labels pass 9s https://github.com/boykopovar/AnyPS5/actions/runs/41341836892/job/124953317379
windows pass 8m52s https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950260026
linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950261442
register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950262057
relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950261532
relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950262271
write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950262292
eligibility pass 6s https://github.com/boykopovar/AnyPS5/actions/runs/41340817511/job/124950221556
intake pass 20s https://github.com/boykopovar/AnyPS5/actions/runs/41340817453/job/124950221653
library-portability pass 1m45s https://github.com/boykopovar/AnyPS5/actions/runs/41340817498/job/124950220434
report pass 50s https://github.com/boykopovar/AnyPS5/actions/runs/41340817510/job/124950220441
Findings
Blocking
None found in the previously reviewed source.
Non-blocking
The source review and author-reported tests were not repeated in this CI-only follow-up.
Sources
- Reviewed knote behavior and tests at this exact head
- Hosted Windows job for this head
- Hosted labels check for this head
Not verified
No local build, C++ tests, Linux/macOS test, console run or GPU behavior was performed in this follow-up. Linux and specialized hosted jobs were skipped.
To get this to a good state
No further action is needed for the reviewed head. If it changes, I will review the new head and its checks.
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — same head, changes requested
I found two review blockers that were missed in my earlier approval: the new test pins an intentionally unimplemented write case, and the reported debt-file overlap with open PR #12741 has no declared landing order.
What I ran
Re-checked head f0a712175fbd7448827b6be896a521d4e36b5040 against base f2d874c1fdccf781c0fa5d86619bb5dd8894b958; the head is unchanged. Linux x86_64; source, PR discussion and live overlap reports inspected. No build or tests were run for this corrective review.
gh api repos/boykopovar/AnyPS5/pulls/14832
gh api repos/boykopovar/AnyPS5/pulls/14832/files
gh api repos/boykopovar/AnyPS5/issues/14832/comments
gh api repos/boykopovar/AnyPS5/pulls/12741Results
| Check | Result | Note |
|---|---|---|
| Exact head and base | passed | Head unchanged |
| Test assertion | failed | Asserts an unimplemented path throws |
| Overlap coordination | failed | Open #12741 edits the same debt paragraph |
| Build and tests | not run | Corrective source review only |
Findings
Blocking
GuestKqueue.cppasserts thatEVFILT_WRITEwithNOTE_LOWATzero throws, whileKqueue.cppdeliberately leaves that behavior unimplemented throughNotImplemented_nid_no_patch. This test would make a later implementation fail despite correct progress. Please remove this assertion or implement and test the write-side behavior in scope.- The live overlap report confirms open PR #12741 also rewrites the
docs/dev/debt/libkernel.mdparagraph changed here. This PR's description acknowledges the shared line but saysDepends on: none; repository contribution rules require agreeing the order with the other author and declaring that order. Please coordinate with #12741 and update the dependency/landing-order declaration accordingly.
Non-blocking
None.
Sources
- Write-side implementation remains explicitly unimplemented at this head
- The new test assertion
- Contribution rule for overlapping PRs
- Open PR #12741 changes the same debt entry
Not verified
No build, test run, or console behavior was checked in this corrective pass. The earlier review's test evidence was supplied by the author, not run by me.
To get this to a good state
Remove the assertion for the intentionally unimplemented write path, and coordinate the shared debt-line landing order with #12741; I will re-check the changed head and rerun the applicable no-build checks.
✅ AMD GPU test: passedPR head
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (9, not counted against this PR)Passed on retry (2, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validation IDs already present on main (5 IDs in 556 tests)Skipped (56)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
@SHOnnay this PR and #12741 both change the kqueue and kevent entry in #12741 was opened first, so I propose it merges first. This PR now declares @MarcZX10 |
|
#12741, this PR's Head
Rechecked on AI-assisted: yes (Claude Code) |
A socket EVFILT_READ knote whose NOTE_LOWAT mark is below 1 is now always ready and reports the bytes in the receive buffer, 0 when it is empty, because FreeBSD 11.4 filt_soread returns kn_data >= kn_sdata and the bytes available are never negative. This holds for level-triggered and EV_CLEAR knotes and when EV_ADD changes the mark of an existing knote. A listening socket ignores the mark, as filt_solisten does. An EVFILT_WRITE mark below 1 still throws. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Kqueue.cpp deliberately leaves EVFILT_WRITE with NOTE_LOWAT below 1 unimplemented through NotImplemented_nid_no_patch, so LowWaterMarks no longer asserts that it throws. A later implementation of that path would otherwise fail the test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
b15b896 to
3f228ad
Compare
|
Checked the read-side |
What
A socket
EVFILT_READknote withNOTE_LOWATand a mark below 1 threwNotImplemented_nid_no_patch. It now follows FreeBSD 11.4.filt_soreadsetskn_data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctland, withNOTE_LOWAT, returnskn_data >= kn_sdata.sbavailreturns au_int(sockbuf.h), so the difference is unsigned andkn_data, anintptr_t(event.h), is never negative. A mark of 0 or below is therefore always met:keventcall, withdataset to the queued bytes: 0 on an empty socket, withoutEV_EOF.EV_CLEARknote is reported once when it is added and again after new data arrives, becausekqueue_scandequeues anEV_CLEARknote after reporting it.EV_ADDon an existing knote replaces the mark, askqueue_registercopieskev->dataintokn_sdatafor descriptor filters and then callsf_event. A drained socket re-added with -1 is reported (data0); re-added with 1 it is not.soo_kqfiltergives itfilt_solisten, which has noNOTE_LOWAThandling.EVFILT_WRITEmark below 1 still throws.filt_sowritecomparessbspace, which can be negative, and returns 0 on an unconnected socket whose protocol requires a connection, so a write mark below 1 is not always met.The kevent measurements entry in
docs/dev/debt/libkernel.md(payload processes on a PS5, firmware 12.70) recorded the level-triggered stream-socket case as still throwing here: a mark of 0 on an empty Unix-domain stream socket gave a read event at once (data0), and so did re-adding that knote with -1 once the socket was drained. This PR implements that behaviour and removes the clause from that entry (line 172). In the kevent entry (line 167), "Marks below 1 ... throw" now says a read mark below 1 is always met except on a listening socket, and a write mark below 1 throws. TheEV_CLEARand listening-socket cases are not measured on a PS5.Code:
DescriptorLowWaterinEqueue/src/Kqueue.cppthrows for a mark below 1 only onEVFILT_WRITE. The newLowWaterAlwaysMetsetsKernelEqueueEvent::lowWaterAlwaysMetwhen a knote is added and whenEV_ADDchanges an existing one. The level-triggered poll inEqueue/Equeue.cppandPollEdgeinKqueue.cppreport a socket that the host does not report as readable when that flag is set and the socket is not listening, withdata0 and no EOF.Tests in
core/libs/tests/GuestKqueue.cpp:LowWaterMarks: a mark of 0 on a stream socket with 4 queued bytes (data4); a mark of 8 there (no event). On an idle stream socketpair: a mark of 0 (event,data0, noEV_EOF), then 3 bytes sent (data3), then a re-add with -1 after draining (data0) and with 1 (no event).EdgeTriggeredSocketRead: anEV_CLEARknote with a mark of 0 gives one event withdata0 and none on the next call, then one withdata2 after 2 bytes are sent, then none.Overlap: no open PR implements a read mark below 1. Open-PR searches for
NOTE_LOWAT,low water,lowatandfilt_soreadreturn #7088, #7121, #9843 and #10645, and all four keep the throw or don't touch it.tools/pr_overlap.pyreports feat(equeue): implement macOS edge watches #12741 (macOS edge watches) on debt line 167. feat(equeue): implement macOS edge watches #12741 rewrites that entry and keeps the "Marks below 1 ... throw" text, and it changesEdgeWatch.cpp, not the code here. feat(equeue): implement macOS edge watches #12741 was opened first, so the proposed order is feat(equeue): implement macOS edge watches #12741 first (Depends on: #12741, proposed to its author in a comment here). After feat(equeue): implement macOS edge watches #12741 merges, this branch is rebased ontomainand keeps both edits to that line.RejectEdgeWriteMarknext toDescriptorLowWaterand inAddDescriptorKnoteandModifyKnote, and adds a write-side test inGuestKqueue.cpp. It is write-side only and changes none of the lines this PR changes, but itsKqueue.cpphunks are next to ours and it also rewrites the same kevent debt entry, so the second to merge will likely need a rebase.sceKernelAddReadEvent/sceKernelAddWriteEventpath inEqueue.cpp(lines 876-896 onmain) and debt line 192 for sizes above 1. It does not touch the kevent read-mark-below-1 throw.main. I searched each of their diffs for added or removed lines namingNOTE_LOWAT, low water,lowWater,below 1orfilt_soread; for feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021, wheregh pr difffailed, I searched its per-file patches from the GitHub API. Only feat(libkernel): support kevent read and write events on regular files #7088 and fix(libkernel): throw on an EV_CLEAR EVFILT_WRITE knote with NOTE_LOWAT above 1 on a Linux TCP socket #9843 match, as above. feat(libkernel): support kevent read and write events on regular files #7088 makes regular files ignoreNOTE_LOWATand keeps "marks below 1 ... throw" in its rewrite of the debt entry. feat(libkernel): report open, read and close notes on watched files #7121, feat(libkernel): implement the named ksem semaphores #9293, feat(libkernel_sys): implement POSIX message queues #9297 and feat(libkernel_sys): implement kmq_notify registration #9302 shareEqueue.hpp,Equeue.cpp,Kqueue.cpporGuestKqueue.cppbut change none of the code lines this PR changes and no low-water text.Tested
Windows 11 Home 10.0.26300.9711, Git Bash, WinLibs gcc/g++, Ninja, Release. No title or homebrew; only the guest kqueue and public header tests were run.
e450145140, before the branch was cut:git submodule update --init --recursive --jobs 8,cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=ON -DPython3_EXECUTABLE=C:/Python314/python.exe,cmake --build build --parallel 4: exit 0.f2d874c1fd), after the last edit:cmake --build build --target guest_kqueue_tests --parallel 4rebuilt 11 libkernel objects, among themEqueue.cppandKqueue.cpp, andGuestKqueue.cpp, and relinkedlibkernel.prxandguest_kqueue_tests.exe: exit 0.ctest --test-dir build -R '^guest_kqueue$' --no-tests=error --output-on-failure --timeout 120: 1/1 passed (5.55 s).f0a712175f:ctest --test-dir build -R '^guest_kqueue|public_headers' --no-tests=error --output-on-failure --timeout 120: 67/67 passed (public_headers,public_headers_compile_0to_63,guest_kqueue,guest_kqueue_cleared_race).python tools/check_conventions.py --base origin/main: exit 0, 0 errors and 2debt-lengthwarnings fordocs/dev/debt/libkernel.md. Line 167 is 3622 characters (3537 onmain) and line 172 is 4159 characters (4336 onmain); both were already over 1000 characters onmain.python tools/pr_overlap.py --branch feat/libkernel-kevent-lowat-below-one: exit 2. It probed 2023 open PRs and fails closed when it cannot compare every one. The manual comparison is under What.b15b896411, which removes theThrowsassertion for anEVFILT_WRITEmark of 0 fromLowWaterMarks(the write path still throws inKqueue.cpp, and no test pins it):cmake --build build --target guest_kqueue_tests --parallel 4: exit 0.ctest --test-dir build -R '^guest_kqueue' --output-on-failure: 2/2 passed (guest_kqueue,guest_kqueue_cleared_race).tools/check_conventions.py: exit 0, 0 errors and the same 2debt-lengthwarnings.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code