Repository navigation
Conversation
…ent on regular files Both threw for a regular file. They now follow FreeBSD 11.4's filt_vfsread and filt_vfswrite: a read event reports the file size less the descriptor's offset and fires while that is not 0; a write event always fires with data 0. A wait holding such an event polls it again every millisecond, as no host call reports every file change. A size above 1 and other vnode types still throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for your contribution! Authors with no pull requests merged into |
|
Thanks, the filters match FreeBSD's
So closing a regular file while another thread waits on an equeue with a read event on it can deadlock both threads. The 1 ms repoll re-enters that order a thousand times a second. A long read or write on the same descriptor also blocks every equeue operation for its duration, because the poll waits for the positioned lock while holding Could you avoid calling into the File layer while holding Separately, this conflicts with #8523 in |
|
@oneandonlydean Thanks for the review. Both problems are fixed on the branch:
With fix 2, the close reorder from fix 1 isn't needed to avoid the deadlock any more. I kept it because it does no harm, but I can drop it if you'd prefer a smaller diff. Tested on Windows 10 (WinLibs GCC 15.2): The conflict with #8523 in |
|
Since this can't be reopened, I opened a copy as #9099: the same change with both review fixes ( |
What
sceKernelAddReadEventandsceKernelAddWriteEventthrew for a regular file: they only accepted guest sockets and the read end of a pipe. They now follow FreeBSD 11.4's vnode filtersfilt_vfsreadandfilt_vfswrite:data(negative past the end) and fires while that is not 0.data0.FreeBSD activates these knotes when the vnode changes. No host call reports every file change, so
WaitForDescriptorsre-polls an equeue that holds a regular-file event every millisecond (a newKernelFilter::repollflag), instead of handing the file topoll/WSAPoll. A write made through another descriptor is therefore seen up to 1 ms late. A size argument above 1, directories and other vnode types still throw, as recorded indocs/dev/debt/libkernel.md. Whether the console's own file systems answer these filters asvfs_kqfilterdoes was not measured.keventon regular files is left to #7088, which implements the same FreeBSD filters there. This PR only touches the equeue path (Equeue.cpp), which #7088 does not change. If #7088 lands first, its file classification could replaceRegularFilehere.#8523 edits the same lines of
WaitForDescriptors, so whichever merges second needs a small rebase.Tested
Windows 10 Pro (10.0.19045), WinLibs GCC 15.2.0 posix UCRT r7, Release, full build with
-DBUILD_TESTING=ON, onmain83751168dd.guest_socket_eventshas a newRegularFileEventscase: a read event with the offset mid-file (data8) and at the end (times out), woken when a second descriptor appends 3 bytes (data3); a write event (data0); a size of 64 throws; afterclosethe event is gone (ENOENT) and a new add fails withEBADF.guest_socket_events,guest_kqueueandguest_equeue_eventspassed 3 of 3 runs each.select_tests,guest_select,guest_kernel_errors,guest_http2,guest_ampr_markers,guest_video_out_hdrandvideo_out_flip_decode(every other test program that uses equeues or kqueues) pass. The VideoOut flip tests that need a display were skipped, as on CI.main'sEqueue.cpp,guest_socket_eventsaborts (0xc0000409).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