fix(agc): describe the pages after a gap in a Linux host page query #442
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/442"
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 oneandonlydean on 2026-10-03T07:35:10Z.
What
On Linux, a host page query that no cached page table covers walks
/proc/self/mapsline by line (describePages). When the cursor sat in a gap between two mappings, no line contained it, so the scan read the whole file and then reported the rest of the range as unmapped, including mapped pages after the gap.CommittedRangesandAccessiblethen gave a wrong answer for any range that starts in, or crosses, an unmapped hole.The scan now stops at the first mapping above the cursor, reports the gap up to it as inaccessible and continues from there, which is what the
VirtualQuerypath already does with a free region. A range with no mapping above it is still reported unmapped to its end, as before.It is also a speed fix: PPSA21564 queries near-null addresses (0x18, 0x30, 0x58) about 1500 times a second during resource capture, and each of those queries parsed every line of the maps file (about 5700 lines on my machine, mostly NVIDIA mappings) before giving up. That was about 220 us per query instead of 32.
#157 (where I offered this as a follow-up) rewrites this loop around a cached snapshot of the maps, but keeps the same behaviour: when
findRegionmisses, it emits{cursor, end, false, false}for the rest of the range. If #157 lands first I'll rebase this onto it; the fix there is the same few lines.Tested
BUILD_TESTING=ONandctestpass.RunUnmappedGapTestsinagc_driver_graphics_tests(GuestAllocations.cpp, Linux only): maps three host pages, unmaps the middle one, and checks thatCommittedRangesreturns the first and third pages, that a query starting in the gap returns the third page, thatAccessiblerefuses the whole block but accepts the third page, and that a near-null address is inaccessible. Against main'sGuestMemory.cppit fails with "the pages after an unmapped gap in host memory were not described".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 repository (attach them to this PR)