fix(agc): skip Linux host imports of ranges not mapped read-write #1051
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1051"
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 fisherjoey on 2026-10-07T04:41:18Z.
What
On Linux,
importAllocationnow checks that a range is mapped read-write (GuestMemory::Accessible(base, bytes, true)) before offering it toVK_EXT_external_memory_host. Ranges that fail the check are copied, as any refused import already is. This matches what the Windows branch does for read-only memory. A TechnicalDebt line records the driver behaviour.The NVIDIA driver refuses imports of mappings it cannot pin writable with
VK_ERROR_OUT_OF_DEVICE_MEMORY, and after that everyvkAllocateMemoryon the device fails the same way, including plain device-local allocations. Onmain, the read-only sections of the relinked image are offered for import, so the first refusal ends the title on its next texture or buffer allocation:Standalone repro (no AnyPS5): import one 1 MiB mapping, then allocate 16 MiB of device-local memory.
MAP_PRIVATErwMAP_PRIVATErwMAP_SHAREDrwMAP_SHAREDrwmprotectto r or rxMAP_PRIVATEr or rxMAP_SHAREDrwDirect memory (memfd
MAP_SHARED) is unaffected. Linux write watch uses userfaultfd write protection, so watched pages still read asrwin the mapping and stay importable.Fixes #1022.
Tested
Linux 7.2 (Nobara 44), GCC 16, RTX 5070 Ti, driver 595.91.07.
APS5_NO_HOST_IMPORT=1(about 0.4 fps) was the only way to keep it running. (It still needs #1047 to get past its black screen, tracked in #1025.)ctest: 380 of 380 pass.agc_driver_lds_atomics64andagc_driver_scalar_sop1are excluded: they also fail on unmodifiedmainon this GPU (the first one hangs it, Xid 109).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T04:57:23Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/TechnicalDebt.mdL255docs/dev/TechnicalDebt.mdL255docs/dev/TechnicalDebt.mdL255docs/dev/TechnicalDebt.mdL255Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T05:48:10Z.
Checked the
Accessible(base, bytes, true)check against/proc/self/mapspermissions (same rule as the Windows branch for read-only memory), rebased on currentmain: build and ctest 415/415, CI green. The NVIDIA behaviour and the Demon's Souls run are taken from your repro and Dean's review (we can't run either here).Added one commit: the TechnicalDebt line now says shared mappings of regular files, which the driver also refuses, are not checked for. Merging.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T07:43:18Z.
Rebased again on current
main(only a TechnicalDebt.md adjacency conflict with the CMASK line; both lines kept, no logic change). Build and ctest 423/423 pass. TheAccessible(base, bytes, true)check matches the Windows branch for read-only memory, and the TechnicalDebt line says shared file mappings, which the driver also refuses, are not checked for. The NVIDIA behaviour and the Demon's Souls run are taken from the repro and Dean's review (not reproducible here). Merging once CI is green.