Repository navigation
fix(agc): cache Linux describePages results - #4395
Merged
Merged
Conversation
describePages stored the whole VMA that PROCMAP_QUERY or /proc/self/maps returned. Linux merges adjacent anonymous mappings with equal flags, so an arena VMA can span GiBs, and the first table miss inside it after an invalidation rewrote every page of it. Only the pages of the request, rounded out to whole pages, are stored now, as boykopovar#1791 describes. When the guest arena is available, RunUnmappedGapTests checks that a check stores no pages outside its range, and that protecting and unmapping through the registry clears the stored pages. The registry checks follow the test on the perf/linux-page-cache branch linked from boykopovar#1791. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Revoke a checked arena page with mprotect behind the registry and check that the stored answer comes back, so the test fails without the cache. Pass the gpu argument that GuestAllocations::Mutation::Add and Protect now take.
9 tasks done
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This carries #1810 by @Swastik-51, rebased onto
mainafter #3454, with the commits and their authors kept:fix(agc): cache Linux describePages results(@Swastik-51),fix(agc): store only the requested pages of a Linux page query(@ahir061) and the test commit I pushed to that branch on 10-10. #1810 was reviewed and accepted there; it could not go green because theAI-assisted:line of its description was never answered, which only the author can do on his PR. The only conflict was the name #3454 gave the query helper:ProcMapsQueryFd()is nowHostMapping::QueryFd(), and the carry uses the new name. The changed lines are otherwise the same as in #1810.Fixes #1791.
On Linux,
describePagesasked the kernel (PROCMAP_QUERY, or/proc/self/mapson kernels before 6.11) what a guest range maps to but did not store the readable pages it found in the page table, so every uncached guest-range check repeated the query.PageStates::record(), shared by both platforms, which stores the page state. The WindowsVirtualQuerypath already did this inline and now calls it.PROCMAP_QUERYpath and the/proc/self/mapspath store their results the same way.Titles, from the runs posted on #1810:
PROCMAP_QUERYioctl fromdescribePageswas the top frame in 116 of 400 samples of the AGC worker thread there./proc/self/mapspath is used: logos and intro movies 5-6 → 57-60 fps, and the title screen is reached (@johnmaia).Tested
Linux (CachyOS, kernel 7.2, GCC 16.2.1, RTX 4090, NVIDIA 610.57.04), Release, configured with the CI flags (
-DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON), onmain2979ae3:agc_driver_graphics(the arena block ofRunUnmappedGapTests, which runs on Linux since fix(guest-arena): place guest address space in the PS5 window on Linux #861): withGuestMemory.cppas onmainand the test from this PR it fails witha checked arena page was queried again instead of read from the page table; with the change it passes.ctest -R "agc|guest_|memory|write": 752 of 752 pass, onmainand with the change (agc_driver_stencil_ref_exportreports skipped on both).python3 tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.Not tested here: the
/proc/self/mapspath (this kernel hasPROCMAP_QUERY; @johnmaia ran it on kernel 6.8, before the rebase), Windows (theVirtualQuerypath only moves intorecord(); the CI job is the test), and Hades II on this rebase.Checklist
main; no other open PR implements the same functions (fix(agc): cache Linux describePages results #1810 is the PR this replaces)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)