fix(ampr): preserve pooled pages across AMM remaps #3902
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3902"
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 MarcZX10 on 2026-10-11T19:01:24Z.
What
Prevents AMM from returning pooled physical pages while another virtual mapping still references them, and reserves remap targets before releasing their old pages. Adds regression tests for alias remaps and pool exhaustion, including reusing a page after its final alias is unmapped. Updates the AMM ownership debt note.
This carries the two AMM ownership fixes from #3321. The four commits retain their original authorship, including the restored alias regression test.
Tested
ee4962190plus these four commits: full default build,libs, six selected AMPR/AMM/guest-memory tests, conventions and whitespace checks passed. Their four-way control matrix reports each regression fails on the pinned base and passes with both fixes. These results are not from the current rebased head.git diff --check upstream/main...HEADpassed. No build or runtime tests were run after the latest rebase ontomainfc1f063f5.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 repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:18:35Z.
Conflicts with main in
core/libs/tests/GuestAmpr.cpp; please rebase. DoesTestAmmMapFailureKeepsPoolOwnershipfail on main, and which test fails without 69b970e14 (the alias-remap commit)? The description lists five cases and the diff adds one test.Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-12T17:10:45Z.
Hi, I'm Blazing Cook. I checked both questions and found a lost test in the carried series:
78d196d15replacedTestAmmRemapKeepsPoolReferencesand its call withTestAmmMapFailureKeepsPoolOwnership. The alias regression is still missing at the rebased head29f9bb19.Thanks for the rebase. I put a single test-restoration commit on top of your new head: 1c1e4f4d, branch. It adds the original alias regression and its invocation alongside the pool-exhaustion test. You can cherry-pick that commit into this PR; the existing authorship stays intact.
Yes,
TestAmmMapFailureKeepsPoolOwnershipfails on the pinned main runtime. I also ran each regression in a fresh process with the same executable while rebuilding only the production variants:2a5eca11cWithout the alias fix, the alias regression fails at
Require(rejected)because another allocation succeeds while the physical page is still in use. Without the map reservation fix, the other regression fails at the protection check after the oversized allocation: the old target remains mapped. With the fixes, both pass and the existing AMPR tests still pass together.The map test exercises pool exhaustion, not an injected host mapping failure. It does not establish console rollback semantics. The restored alias test covers remapping onto an existing alias, self/overlapping remaps, exhaustion while an alias survives, and reuse after releasing the last alias. That is the coverage the description should refer to.
Windows, MinGW-w64 GCC 15.2.0: full default build plus
libs, six selected AMPR/AMM/guest-memory checks, conventions and whitespace checks passed. No title run or Linux result is claimed for this update.Please also remove
Closes #3321: this PR covers two items from that larger report. We already have Ratchet & Clank memory-placement evidence in #2704 and #3146; there is no need to resend it. Those reports do not show either ownership failure tested here. If someone encounters one of these failures in a title, the useful evidence is the title ID/version, exact AnyPS5 commit and patch stack, pool size, physical page, and map/remap/unmap sequence around the stop, with matching before/after logs for the isolated fix. Logs or a small redistributable repro are enough for this request; I am not asking for a game dump.AI-assisted with Codex; the source variants, failure locations and saved hashes were independently reviewed.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:43:38Z.
Thanks for checking the rebased head and for separating the two regressions with the control matrix. The restored alias test is missing from the current PR head, and I agree the map test demonstrates pool exhaustion rather than an injected host mapping failure. I have not applied your offered commit yet; I will review it before updating the branch and narrowing the description.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:50:53Z.
I reviewed Blazing Cook’s offered commit
1c1e4f4d. It restores the missing alias-remap regression and its invocation, and the author supplied a control matrix showing each ownership fix fails without its corresponding test. The commit is based on the prior head29f9bb19, so it needs to be carried onto the current headd75176d.The overlap check now flags #4207 in
GuestAmpr.cpp; the changes are functionally independent, but the test insertions need coordination. @xXPBSXx, would you prefer #3902’s test restoration to land first, or #4207? Whichever lands second can rebase the test-file change. I’ll hold off pushing the offered commit until we agree on the order.Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-12T22:28:34Z.
Hi, I'm Blazing Cook. Since #4207 has merged, I rebased the carried series at
d75176d43onto upstreamee4962190and restored the missing alias regression alongside the pool-exhaustion test.TestAmmUsageStatsis preserved, so the overlapping test insertions are resolved.The updated branch ends at 4cbda1fb3. The three carried commits retain their original authors, including Marc's follow-up. The fourth commit restores the test. All upstream AMPR test calls are preserved.
I reran the checks on Windows with MinGW-w64 GCC 15.2.0: full default build,
libs, all six selected AMPR/AMM/guest-memory tests, conventions and whitespace checks passed. The same probe executable was used for each test across all four production variants:ee4962190The negative runs fail at the intended assertions:
Require(rejected)at GuestAmpr.cpp:1051 and the old-target protection check at :1102. The final source was restored and rebuilt before the six tests ran.The pool-exhaustion test does not exercise the host mapping catch path or establish console rollback behavior. This update has no title run or Linux result. The existing Ratchet logs are already linked above; they do not demonstrate these ownership failures.
This branch also merges cleanly with later upstream
43e3a70f8; the runtime results above are specifically foree4962190plus the four commits. Please keep both regressions when updating this PR and keep its scope to items 3 and 9 of #3321.AI-assisted with Codex. A separate review checked the preserved tests, source variants, expected failures, hashes and final results.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:12:03Z.
Thanks for restoring the alias-remap regression and rerunning the four-way control matrix on Windows. The current PR head still does not include commit 4cbda1fb3. I have not applied it yet; I will check that the offered test patch matches the current PR tree and then either carry it with your authorship preserved or report any issue I find.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:43:22Z.
Rebased the four-commit series onto current
main(6d7b87370), preserving the original authors of all four commits, including the restored alias regression. The branch now includes bothTestAmmRemapKeepsPoolReferencesandTestAmmMapFailureKeepsPoolOwnership, alongsideTestAmmUsageStats.The supplied Windows control matrix is useful evidence for the earlier base
ee4962190: each regression fails without its corresponding fix and both pass together. I updated the description to identify that base and to make clear the rebased head has not been rerun.git diff --checkpasses on the rebased patch; I have not run a build or runtime test after the rebase. The description now says this PR carries two items from #3321 rather than closing the larger report.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T09:48:35Z.
Read through the ownership changes (page references held across remap, target reserved before old pages are released, per-run
_addPagein_mapPages), the two regression tests and the debt note; they are consistent with each other and with the description. Merging once the full Build (linux and windows) is green on this head.