Repository navigation
Conversation
|
Coordination note with open #4391: that PR moves guest sockets to low ordinary descriptors and changes kqueue socket detection from |
|
Thanks, yes — I'll carry it. To be precise about what is at risk here: the watermark code itself classifies nothing. The follow-up I'm preparing touches those same lines and takes the membership check with it: |
e052bbf to
79648ee
Compare
|
Windows test: head AI-assisted (Claude Code). |
|
Thanks for the Windows run — that is the one platform I cannot check here, so it closes half of the checklist. The other half, which your note says you did not run: the cases this PR adds or rewrites do fail on |
… events Before: NOTE_LOWAT and a size above one in sceKernelAddReadEvent and sceKernelAddWriteEvent threw, so a title waiting for a number of bytes could not register the event at all (PS5MC and XPSemu import both the kevent filter and the two calls). Now the knote holds the event until the socket has the requested bytes, or the requested free space, as FreeBSD's filt_soread and filt_sowrite do before they compare kn_data against the mark; an end of file is still reported below it. A kevent that re-adds the knote without NOTE_LOWAT clears the watermark, as kqueue_register copies the whole kevent over it. A mark is not something poll readiness can express: a socket below the mark is already readable, so a wait that has one returns to its caller every millisecond instead of spinning on the readable socket, the slice the pipe path already uses.
79648ee to
1d60375
Compare
|
Rebased on current The conflict was in Local verification on |
|
Thanks for rebasing on |
|
Closing: no title is known to reach this. With the queue at 480+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line. |
What
kevent'sNOTE_LOWATand thesizeargument ofsceKernelAddReadEventandsceKernelAddWriteEventare the same thing: a low water mark that holds the event until the socket has that many bytes, or that much free space. Both threw, so a title that waits for a number of bytes could not register the event at all.A mark is now kept per knote (
KernelEqueueEvent::lowat) and the descriptor filter compares the count it polls against it:keventwithEV_ADDandNOTE_LOWATregisters the mark, whose value iskn_sdata;NOTE_LOWATclears it, askqueue_registercopies the whole kevent over the knote it re-adds;filt_soreadandfilt_sowritereturn before they comparekn_dataagainstkn_sdata;sceKernelAddReadEventandsceKernelAddWriteEventtakesizeas that mark, where 0 and 1 are the readiness the default knote reports.A mark is not something poll readiness can express: a socket below it is already readable, so a wait that has one returns to its caller every millisecond instead of spinning on the readable socket, the slice
GuestSockets::WaitAnyalready uses for pipes.Tested
Linux (Fedora 44, GCC 16.2.1, release with
BUILD_TESTING), full build,ctest --test-dir build -E "agc_|video_out|lds_|msaa"534/534,python3 tools/check_conventions.py --base origin/mainclean.New cases in
GuestKqueue.cpp: a registered mark reports only at the fourth byte, a re-add withoutNOTE_LOWATclears it, raising it above what the socket holds holds the knote again, and the write filter of the other end keeps its own mark (a mark above the send buffer size it reports never triggers).GuestSocketEvents.cppdoes the same through thesizeofsceKernelAddReadEventand the same write case; that file used to assert the old throw there.Not tested on the console, and not reached at run time yet: PS5MC (PPSA99420) and XPSemu (PPSA97358) both import
kevent(NIDRW-GEfpnsqg) and both calls, andtools/import_audit.pyon their relinked registries reports them as stubs, but each stops earlier on an absent import (ixrw0h2tWuI,chflags, andx7g7Ebeo8-U,mlockall) that this PR does not touch. The semantics follow the FreeBSD 11 sources the existing filter was written from (kern_event.c, andfilt_soread/filt_sowrite).EV_CLEARon a socket still throws, deliberately: reporting once is easy, but re-arming needs a sign that the socket's state changed, and a write event reports the constantSO_SNDBUFas its data, so a title that writes and waits again underEV_CLEARwould never be woken.EVFILT_READon a kqueue,EVFILT_READ/EVFILT_WRITEon a non-socket descriptor and the timer changes also still throw; those are separate paths.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)keventand these calls; neither reaches them yet