fix(agc): let imports that cannot write guest memory keep the watch armed #10369
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10369"
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 krishalivaibhav on 2026-10-23T19:36:50Z.
What
Fixes #10344 (first assertion).
ImportWatchedopened a blanketGuestArena::HostWriteover the whole import window on macOS, because the host cannot know which pages an import will store to.Watch::BeginHostWritethen unprotects every page and marks itWritten, so every block of the window read as CPU-written, including blocks the import never touched (agc_write_tracking/CheckImportWindow: "a block the import window did not touch reads as written").This adds a trailing
importMayWriteGuestparameter toImportWatched, defaulting totrue(today's behaviour). Whenfalse, the window stays write-protected during the callback, and the fault handler'srecord()marks only the pages that are actually stored to. Only the DMA-BUF import inGuestBufferMemory.cpppassesfalse: its callback creates the import in-process and never writes the range through a kernel API (analysis by MarcZX10 on #10344). The host-pointer import keeps the defaulttrue: withfalsethere,agc_driver_depth_plane_buffer_memoryfailed on macOS (found and fixed by iamthehimansh, merged from krishalivaibhav/AnyPS5#2). Callbacks that can write through a kernel API (read()/recv() into the buffer, which would fault with EFAULT on a protected page) keep the default.CheckImportWindowopts out because its callback stores in-process. Non-Apple code is unchanged.Tested
Current head
9b187f0ef(DMA-BUF site only):describePagesone-liner):agc_write_trackingpasses 3/3 andagc_driver_depth_plane_buffer_memorypasses with only the DMA-BUF site opted out; with the host-pointer site also opted out, the depth-plane test failed 3/3.agc_write_trackingpasses the targetedCheckImportWindowcheck, then stops at the separateCheckUnwatchedImportissue from #8658'sdescribePagesbranch (not inmain; the one-line fix is in https://github.com/boykopovar/AnyPS5/pull/8658#issuecomment-6373190860). The other 25 write-watch/import tests pass with and without this PR.Earlier two-site version
8cf0a39f8:CheckImportWindowpasses;write_watch_*(10/10) andagc_write_watch_coveragepass.write_tracking|write_watch|host_importtests pass, as onmain, with noVUID-lines;agc_driver_depth_plane_buffer_memoryalso passes there.Linux: not built locally; the parameter is unused there.
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 repositoryCheckImportWindowassertion; theCheckUnwatchedImportfailure behind it is separate)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:38:05Z.
Review: APPROVED
Reviewed current head
8cf0a39f86. The new trailing parameter defaults to the prior behavior, so unreviewed/other ImportWatched callbacks retain the blanket HostWrite on Apple. The two opt-outs are limited to the host-pointer and DMA-BUF Vulkan import callbacks; their bodies perform property queries/import/bind operations and do not write into the guest range. The existing CheckImportWindow fixture now opts out while retaining its writes to touched pages, covering the behavior this PR changes. The author reports that assertion passes on the M2; the later CheckUnwatchedImport failure is attributed to a separate #8658-only branch and has a separate proposed fix. I did not run the Apple-specific test locally. Hosted eligibility, conventions, intake, labels and report checks pass; product and platform jobs are skipped by path policy.git diff --check upstream/main...upstream/pr/10369passes. I found no blocking issue in this scoped change.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T14:54:58Z.
Review: CHANGES_REQUESTED
Follow-up review of exact head
9b187f0effe9cf695ebd14b994e239b6e7dce141. The updated diff now opts out only the DMA-BUF import; the host-pointer import uses the defaultimportMayWriteGuest=true, consistent with the macOS depth-plane regression matrix in the thread. The PR body is stale: it still says both GuestBufferMemory callers passfalse. Please update the description and tested summary to record the final one-site behavior, the M2 result (the targeted CheckImportWindow assertion passes, then this macOS-series run encounters the separate #8658 CheckUnwatchedImport issue), and the Windows 17/17 Vulkan-validation run. This is needed so the review evidence describes the current head rather than the superseded two-site version. The code change itself is appropriately scoped to the dma-buf callback.