fix(libkernel): support POLLPRI on Windows sockets #4525
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4525"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-12T14:30:20Z.
What
Fix the Windows socket stop
poll: POLLPRI is not supported by WSAPoll. Ask WSAPoll forPOLLRDBANDwhen the guest requestsPOLLPRI, and forPOLLRDNORMwhen it requestsPOLLIN, keeping urgent data separate from ordinary readability. Returned flags are still masked by the guest's requested events. Linux keeps its native mapping.Carries screamm's
1a20b493implementation and urgent-data tests with the original author preserved. Rebased onto main2a2a3dc650b9245fb0fb9b088afb1a6c27637f7dat head5db1d8d5e933c5096ed87530898c2989becec4d7, after #4391 merged. The resolution retains main's allocated socket descriptors, its descriptor lookup, the pipe-poll tests from #3644, all urgent-data tests and both sets of limitations indocs/dev/debt/libkernel.md. The Windows event mapping itself is unchanged.The mapping follows WSAPoll's documented flags and FreeBSD 11.4's sopoll_generic. Winsock keeps reporting urgent data until it is read with
MSG_OOB, whereas FreeBSD stops once the normal stream passes the urgent mark. The existing debt entry retains that difference and the guest's unsupportedMSG_OOBsend/receive behavior. This removes a runtime refusal; it adds no newly implemented export to the progress scanner.Title evidence
d1fd9372and a local integration0343f291: Nuvio Max'd (PPSA99288) and ProsperoAI (PPSA99004) both pass this stop and render for 60 seconds; ProsperoTV passes it and reaches a separatefcntlrecord-lock refusal. Those runs used main's test file, without the urgent-data regressions; the validation below now retains and runs both sets of tests.Tested
BUILD_TESTING=ON: full runtime (libs),relinkerand the four focused targets build at exact head5db1d8d5e. LocalANYPS5_ENABLE_SPIRV_TOOLS=OFF.guest_poll,guest_socket_pair,guest_udpandguest_sce_neteach pass five consecutive runs, retaining pipe, descriptor and urgent-data coverage.Udp.cppreplaced by main2a2a3dc65fails atpoll: POLLPRI is not supported by WSAPoll. Restoring the PR source and rebuilding passes all four tests five times again.git diff --checkpass. These are focused checks, not the full CTest suite. Full upstream jobs require a maintainer dispatch. No new title run on this rebased revision is claimed.Merge order
#3644 and #4391 are now merged and are included through the main baseline. The earlier proposed ordering with #4391 is therefore superseded. This rebase retains its descriptor allocation/read/write behavior and validates the combined socket tests. #3649 and #4351 remain closed; no socket-fstat implementation from #4351 is carried here.
Remaining open-PR overlaps
After this rebase, pairwise merges against #4903
2cd842efa(socketfstat) and #4933bc299f299(polling libSceNet sockets) conflict only indocs/dev/debt/libkernel.md. Their source changes merge textually with this head; this is not a combined runtime validation.Proposed order: #4525 first, then those branches rebase; that order is not yet agreed with their authors. For #4903, retain its socket-stat limitations and this PR's urgent-data limitations. For #4933, retain its libSceNet socket lookup/ownership and mixed-descriptor support, while removing the obsolete Windows
POLLPRIrefusal and keepingPOLLPRI -> POLLRDBAND,POLLIN -> POLLRDNORM, requested-event masking, pipe tests and urgent-data tests. If either lands first, this PR will need the small debt resolution and focused socket tests again. Neither is a runtime prerequisite for this standalone fix.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T15:42:11Z.
Review: COMMENTED
On Linux this path is not compiled, so a green here cannot stand for the Windows behaviour — and the report side cannot drift from this change. The change sits inside
#ifdef _WIN32:guest_pollpasses at the head (100% of 1, exit 0) and passes identically with the parent'sUdp.cppin place, which is the expected no-op rather than evidence either way.What I could check without a Windows host:
reventsis filled by walking the same table the request side uses —core/libs/prx/libkernel/Socket/src/Udp.cpp:987-989at35893ea90:so re-pointing guest
0x1/0x2atPOLLRDNORM/POLLRDBANDchanges what is reported as well, with no second table to keep in step.winsock2.h:POLLRDNORM 0x0100,POLLRDBAND 0x0200,POLLIN (POLLRDNORM | POLLRDBAND),POLLPRI 0x0400.POLLINis a union there, so narrowing it toPOLLRDNORMis what preserves the guest's distinction;POLLPRIis a distinct flag rather than an alias ofPOLLRDBAND, so sending the priority request to the priority-data flag is a mapping rather than a redefinition.socketpairandsendmsgrefusals, plus the equeueWSAPollfailure atUdp.cpp:244— a different call.Informational, body only: the
windowsjob in.github/workflows/build.ymlis gated topush/workflow_dispatch(a maintainer can dispatch it for a PR number), so an ordinary PR run does not compile this branch, the Windows-only half of the new test included.Written with AI assistance.
Hermes Agent 🤖 at your service
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T16:31:29Z.
Windows test: head
35893ea90merged onto currentmaind592d54e1(clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest with the filterguest_poll: guest_poll passed (1 test(s), 0 failed);python tools/check_conventions.py --base upstream/mainpassed. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T17:46:14Z.
This is the half I could not supply, and it is the same head I read (
35893ea90). On this host the change is inside#ifdef _WIN32, so my run was a no-op — which is why I said a green here cannot stand for the Windows behaviour. Your run is that evidence, and it is now on the record.One line is still missing on that side: the red arm.
guest_pollpasses at the head and passes identically with the parent'sUdp.cppin place, so on Windows too the green alone cannot separate the new mapping from a no-op. Running your filter against the parent'sUdp.cppwith this test kept would, and it is cheap while the Windows tree is up.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-12T22:04:37Z.
@DariusHQ @pushkarreddyy @milescoviello
Coordinating the overlap with #3644: #4525 carries the Windows socket
POLLPRImapping and urgent-data tests. The overlap flagged here is inGuestPoll.cppand the sharedpolldebt entry; the pipe-readiness behavior belongs to the pipe-poll PR.I propose landing the selected pipe-poll fix and #4351 before #4525. As Marc noted on #3649, #3644 and #3649 still need a maintainer choice, and #3649 also needs coordination with #4391. My current
Depends onlists #3649 and #4351; I can update the pipe dependency if #3644 is selected instead.After the agreed prerequisites land, I will rebase #4525, keep both the pipe and urgent-data tests (including their imports, declarations and calls), combine the debt descriptions, and preserve the Windows
POLLIN->POLLRDNORM/POLLPRI->POLLRDBANDmapping. I will rerun the focused Windows/Linux tests after integration. This comment does not claim a combined validation with the current pipe-poll heads.For this PR alone, the requested Windows negative control is now recorded in CI: replacing
Udp.cppwith the parent makes the new test fail at the oldPOLLPRIrefusal; restoring the patch makes all four focused tests pass three times.Does that ordering work for you, subject to the maintainer's pipe-poll choice?
AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T22:18:59Z.
Thanks for pointing at the Windows negative control. One thing to line up before it counts for this head:
Lorkydey/AnyPS5run 38302727370) reports headede071e5784089def9b23f9c721d598ee7a4c64b.32b2eda2ca(single commit, "fix(libkernel): accept POLLPRI on guest sockets under WSAPoll"), updated 2026-10-12T22:17:56Z.Could you confirm that the parent
Udp.cppswap (guest_poll fails at the old POLLPRI refusal, passes with the patch) was run on32b2eda2ca? If the commit changed after that run, the red arm needs a re-run on the current head. I have no Windows host here, so I cannot reproduce it myself.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-12T22:21:27Z.
@Dextroid17 Yes, the Windows negative control was run on the current PR head,
32b2eda2ca394a43d46d60f09ea08a469ba7bd4c.ede071e578is the commit containing the separate validation workflow. The Windows job explicitly checks out the PR commit at line 18, and its checkout log confirms32b2eda2ca394a43d46d60f09ea08a469ba7bd4c.In that checkout, the negative-control step replaces only
Udp.cppwithHEAD^while retaining the new test. In the Windows job,guest_pollfails atpoll: POLLPRI is not supported by WSAPoll; after restoring and rebuilding the PR source, all four focused tests pass three times.The PR head still matches that tested commit. Thanks for checking the provenance!
AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T22:50:45Z.
@Lorkydey Thanks, you're right, and I checked the run log rather than taking the link on trust.
HEAD is now at 32b2eda fix(libkernel): accept POLLPRI on guest sockets under WSAPoll, which is the current PR head.Udp.cppand the new test kept,guest_pollexits0xc0000409withpoll: POLLPRI is not supported by WSAPoll. After the patch is restored,ctest -R "^(guest_poll|guest_socket_pair|guest_udp|guest_sce_net)$" --repeat until-fail:3runs, so the green arm is recorded too.That closes the provenance question, and the negative control is now on the record for this head. I still have no Windows host, so this is evidence from your CI log, not a run of mine.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-13T01:27:57Z.
Title check on Windows 11 (WinLibs GCC 15.2, RTX 3080) now that #3644 is merged. On
maind1fd9372, three titles that used to stop atpoll: descriptor N is not a socketstop atpoll: POLLPRI is not supported by WSAPollinstead. This PR conflicts withmainnow, so I merged it locally (forktest/verify-pollpri, 0343f291).Udp.cppmerges clean; I keptmain'sGuestPoll.cppfor the merge and unioned the debt line, so this PR's new tests weren't part of these runs.With it the POLLPRI throw is gone in all three:
--trap-sdk-syscall-stubs): renders for the full 60 s,[SX] 59.9 fps, worst frame 20.0-21.3 ms, no throw. This is the first time it renders on Windows.--trap-sdk-syscall-stubs): renders and sits in its UI for 60 s, about 500 submissions per 10 s window, no throw. Its update check fails quietly.[HUI] pad open), then stops at a separate Windows-only throw,fcntl: record locks are not implemented on Windows, command=12, fd=4(F_SETLK on a file).The
RequestFlagschange maps guestPOLLINtoPOLLRDNORMandPOLLPRItoPOLLRDBANDon Windows. Results are still masked byentry.events, so the sharedPOLLRDNORMbit doesn't report anything the guest didn't ask for.Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-13T03:23:27Z.
@MarcZX100 A coordination note for #4391: #4525 is now rebased onto main
c13dc7e6batbf51a206c, retaining both the merged #3644 pipe tests and screamm's urgent-data tests. The WindowsPOLLIN->POLLRDNORMandPOLLPRI->POLLRDBANDmapping remains independent of the socket descriptor allocation scheme.Would #4525 before #4391 work for your next rebase? The combined
GuestPoll.cppshould retain both groups of tests and the native socket includes/linkage, and the debt entry needs both the allocation/pipe semantics and the urgent-mark limitation. #4391 already conflicts with main, so I am not treating a pairwise merge conflict as a runtime dependency or claiming a combined build. The standalone rebased #4525 passes the four focused Windows tests three times, including the main-with-new-tests negative control.AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-13T03:35:04Z.
@babyhuey Thanks for the title retests! Rebased onto main
c13dc7e6batbf51a206c, retaining both #3644's pipe tests and this PR's urgent-data tests, plus both debt descriptions. #3649 and #4351 are closed, so I removed those obsolete dependencies; no socket-fstat code from #4351 is included.@Dextroid17 The negative control has also been rerun for this new head. Windows and Linux build
libs,relinkerand the focused targets;guest_poll,guest_socket_pair,guest_udpandguest_sce_neteach pass three times. On Windows, replacing onlyUdp.cppwith parent main while keeping the combined test fails at the oldPOLLPRIrefusal; restoring it makes the tests pass again. Linux is the non-regression check.Both jobs explicitly check out
bf51a206c6c80c0646605fbcfd44a588c46c9f3d; the separate workflow commit is6ad548f0a. The description now links your title evidence separately from these focused tests. I have not rerun the titles on this rebased head or run the full CTest suite.AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T03:36:39Z.
Thanks for rerunning. I confirmed the PR head is
bf51a206c, the commit you named. Run 38341096951's head is the workflow commit6ad548f0a, so I'm treating its Windows and Linux passes as your CI evidence, not a run of mine. I have no Windows host, so I can't verify the Windows result myself.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-13T04:23:29Z.
Native Windows check of the exact head bf51a206 (Windows 11, RTX 3080, WinLibs GCC 15.2, Release), as there was no Windows host on the earlier review:
guest_poll,guest_socket_pair,guest_udpandguest_sce_neteach pass 5/5 (--repeat until-fail:5). No warnings inUdp.cpporGuestPoll.cpp.Udp.cppis unchanged from the head I ran yesterday; what's new is the extra tests inGuestPoll.cppandws2_32forguest_poll_tests.The same three titles on this head alone (#4480 is merged now, so ProsperoTV needs nothing else), each running the full 60 s with no throw:
[TV] frames=600 mean=23.36ms ... draws=2 shapes=407.--trap-sdk-syscall-stubs): renders and sits in its UI, about 590 submissions per 10 s window.--trap-sdk-syscall-stubs):[SX] 59.9 fps, worst frame 21.6 ms.On
mainc13dc7e6all three stop atpoll: POLLPRI is not supported by WSAPoll.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-13T05:29:13Z.
More titles for this: ProsperoEden (PPSA99008, discussion #4852), PSXS5 (PPSA97510), SwanStationPS5 (PPSA98510) and ProsperoRadio (PPSA99001). On
main(Windows 11, catalog releases; ProsperoEden with--trap-sdk-syscall-stubs) each exits with 0xC0000409 onpoll: POLLPRI is not supported by WSAPoll, shortly after start-up.With bf51a206 merged onto
main(clean merge), the throw is gone and each runs the full 60 s:7e181fcc) draws its launcher at 60 fps. It then stops only for user content (prod.keys, firmware, games).ea2bbefb, PSXS5 and ProsperoRadio render at 59.9 fps and SwanStationPS5 at 119.8 fps, with no throws.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T06:58:09Z.
This unblocks four catalog titles on Windows. Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release. Head
bf51a206cmerged ontomain88107b7de. Each title is relinked with--windows --trap-sdk-syscall-stubsand run for 60 s.mainmain+ this PRpoll: POLLPRI is not supported by WSAPoll, exit after 9 sNuvio Max'd then hits
abort()when the run is closed. Its log shows nothing failing before that, and the close comes after the point this PR changes, so I'm noting it, not counting it against the PR.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:24:16Z.
Thanks for the coordination note. #4391 merged on October 13, so the proposed #4525-before-#4391 ordering is now moot; there is no remaining sequencing conflict from that PR. I see #4525 currently reports a conflict with
main, so please keep the merged socket-descriptor changes and both groups ofGuestPolltests when updating it.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T07:39:57Z.
Needs a rebase: #4391 is merged and this now conflicts with it in
core/libs/prx/libkernel/Socket/src/Udp.cppanddocs/dev/debt/libkernel.md. It gets a full build once it is clean.Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T10:55:45Z.
Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs; basemaind379bfd0with #5025 applied for the title runs (without it currentmaincannot loadlibkernel_sys.prxon Windows, #4877)): the earlier headbf51a206merged ontod379bfd0(two trivial conflicts:mainalready looks up the socket earlier inUdp.cpp, so the duplicateFindblock andmain's POLLPRI throw go; the debt sentence applied tomain's poll bullet). Code matches myfix/libkernel-poll-pollpri-socketscommit (NativePollIn/NativePollPriority, throw removed); the debt text is shorter.guest_poll3/3; suite 685/688 withconventions_function_bodiesandguest_sce_netpassing serially andpatched_librariesbeingmain's #4877 failure; conventions andgit diff --checkpass. The rebased head5db1d8d5has the same code, merges cleanly onto075169f7and passes conventions, but I did not rebuild it.Titles (before,
main+ #5025: all four end withwhat(): poll: POLLPRI is not supported by WSAPollat 3 to 5.5 s): with this PR all four run the whole minute with no stop line: PSXS5FPS: 25.53 (1400), SwanStationFPS: 34.75 (1714), ProsperoTVFPS: 23.63 (686), ProsperoRadioFPS: 21.35 (736)(frame rates lowered by other builds on the host; ProsperoTV/Radio staged withapp0/eboot.bin, see #5040).