AGC: inaccessible guest pages are never cached, so on Linux before 6.11 every probe re-parses /proc/self/maps and Guardians of the Galaxy (PPSA01748) drops to 0.02 FPS; fix branch ready #6183
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Tamalero on 2026-10-15T00:55:14Z.
On Linux kernels without
PROCMAP_QUERY(before 6.11, which includes Ubuntu 24.04 LTS's default 6.8), Guardians of the Galaxy reaches its language screen and then nearly stops: one frame every one to three minutes, with both GPUs idle. On a 6.11+ kernel the same build runs that screen at about 6 FPS. Forcing the fallback withAPS5_NO_PROCMAP_QUERY=1reproduces it on any kernel.The cause is in
GuestMemory's page table.describePagesstores only readable runs, so an answer of "inaccessible" is never remembered. Guardians' table snapshots (TableSnapshotter::Column→ShaderMemory::accessible→GuestMemory::Accessible) keep probing a reserved,PROT_NONEpart of the guest arena, about 190 times a second. WithPROCMAP_QUERYeach probe is one cheap ioctl. Without it, each probe parses the whole of/proc/self/maps(about 7,500 lines here).Title: Marvel's Guardians of the Galaxy (PPSA01748 v01.006.000)
Where it stops: the language screen, on main
411e5e6d9plus #6033 and one NpManager stub the title needs to start. Every run: 3 of 3 on kernel 6.8, 4 of 4 on kernel 7.2 withAPS5_NO_PROCMAP_QUERY=1.What the threads show
/proc/self/mapsat about 140 MB/s (715 MB in 5 s, 4 KB reads;/proc/<pid>/task/<tid>/io). Its stack:ResourceMaterializer::Materialize→TableSnapshotter::Snapshot→TableSnapshotter::Column→ShaderMemory::accessible→GuestMemory::Accessible→verify→describePages→std::getline.2a3490000-2d1160000 ---p. Of the rest, 431 were in the main image and 746 elsewhere, and there were no gaps. A second counter found only a handful of results dropped by a generation change during a parse, so the misses come from the page table never storing inaccessible pages.Fix
Branch: https://github.com/Tamalero/AnyPS5/tree/fix/guest-memory-cache-inaccessible-pages (one commit on
ab9a47684).PageStates::recordstores inaccessible runs as a third page value instead of skipping them.describePagesanswers them from the table like readable runs. Gaps found by either Linux path are recorded the same way. They are forgotten by the same registry invalidation as readable pages.DoMprotect's stack branch and inRestoreStackPagesat thread exit. Both now callGuestAllocationsInvalidate_nid_postfixfor their pages, asGuestHeapalready does.PAGE_GUARDregions are not stored, since the OS clears the guard on first touch. They were not stored before either, because they never counted as readable.RunUnmappedGapTests(agc_driver_graphics) gains a case that reserves an arena pagePROT_NONE, checks it, and opens it behind the registry. The page must still read as inaccessible from the table. OnceGuestAllocations::Mutation::Addregisters it, it must read as accessible.Results
APS5_NO_PROCMAP_QUERY=1Still open (not in this branch)
With the fix, one thread still parses
/proc/self/mapson old kernels, at about 140 MB/s on the desktop. It doesn't hold up frames here. Those lookups are readable addresses in the main executable's writable data (rw-p, anonymous afterbackWritableImageAnonymously).PageStates::initializeonly sets up the image span on Windows, so on Linux every lookup there goes to the host. A Linux image span would cover that; I've left it out, as a separate change with its own invalidation questions.Details and tests
agc_driver_graphicspasses, both with and withoutAPS5_NO_PROCMAP_QUERY=1. WithGuestMemory.cppfrommainand the new test, it fails with "a checked inaccessible arena page was queried again instead of read from the page table" (negative check).ctest -j16: everything passes exceptagc_driver_flip_stores_small_resultsandagc_driver_store_idle_results, which failed once under heavy load (another title running alongside) and passed 3 of 3 when rerun alone.tools/check_conventions.py --base origin/mainpasses.PAGE_GUARDexclusion and the stack invalidation compile there but are unexercised), macOS.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-15T01:07:42Z.
Same slow path, different miss. I opened #6179 an hour ago for the other half. The two don't overlap, and your branch merges cleanly with it.
Shaderheaders it passes fromRegisteredHeader→SameHeader. Those headers live in the host heap. On kernel 6.8 that was 404,000 parses (25.7 s of CPU) in 200 s. For read-only checks of at most 4 KiB on such kernels, #6179 triesprocess_vm_readvon the own process first and falls back to the existing path on any failure.Your change wouldn't cover the Astro case, since those addresses aren't in a span. #6179 wouldn't cover Guardians, since its probes are of
PROT_NONEpages, whereprocess_vm_readvfails and falls back. So both are needed.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T01:10:39Z.
Carried the focused cache and invalidation fix as PR #6184, preserving Cesar Rodriguez as the commit author. I built the targeted graphics test and passed conventions locally; its runtime aborts at the host CPU guard before test code runs on this Xeon. The performance and title results in the issue remain the reporter’s results, not a local reproduction.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T06:52:21Z.
The last open part of this, main-executable addresses going to the host on Linux, is covered by #7788 (
713ee693e), which caches the image's page states. Closing. If the title still crawls on a kernel before 6.11 with current main, please reopen with a trace.