hle/xmem: reuse freed physical page numbers within 21-bit limit #35
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/35"
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 Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T10:33:21Z.
Summary
Port rustno1-coder/VIctory-NVIDIA 108a897 (after vatarmanz/VIctory-7900XTX#316):
umber >> 4), then reuses the lowest contiguous run of freed pages instead of overflowing past 21 bits (~124 GiB cumulative allocations). If no contiguous run fits, it logs a warning, writes to count, and returns .
Rig Specs Tested On
Run Settings & Profile
elease @ $sha (static/clippy + ictory-hle unit suite + CI full workspace suite; no separate live game capture since sequential allocation below ~124 GiB cumulative physical allocations is unchanged)
Measurements & Verification
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T11:03:24Z.
Automated triage for the maintainers (not an approval).
Verdict:
merge-candidate· CI (check):passingTechnical Review
crates/victory-hle/src/modules/xmem.rs):FIRST_PAGE(0x10_0000) andPAGE_LIMIT(1 << 25), matching the title's 21-bitnumber >> 4packing forFRAMES(PAGE >> 12= 16).Pages::take/Pages::take_inpreserves the existing sequential fast path whileself.next_page + n * FRAMES <= PAGE_LIMIT, then falls back tofree_run_into find the lowest contiguous freed run within[floor, limit).self.next_page = self.next_page.max(first + len)preserves the invariant that all live keys inPages::pagesremain strictly belowself.next_page, preventing duplicate page numbers when a reused run straddlesnext_page.XMemAllocatePhysicalPages, iftable.take(n)returnsNone,tableis dropped before returning0and writing0tocount;Section::dropthen cleanly callsvictory_gpu::title_memory_section_goneandCloseHandlewithout holding thePAGESlock.page_numbers_freed_are_given_again_past_the_title_s_21_bitscovers boundary sequential allocation, free-run reuse, overflow/exhaustion, 21-bit packing, and thenext_page-straddling regression case.Verdict
merge-candidate— clean HLE physical page-number reuse fix with solid edge-case handling and unit test coverage (pending maintainer review/merge).Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T21:41:05Z.
Fixed the
Pages::take/next_pageinvariant bug flagged in review (fe3c5e8):crates/victory-hle/src/modules/xmem.rs, whenPages::take_infalls through tofree_run_inbecauseself.next_page + len > limit, it now advancesself.next_page = self.next_page.max(first + len)so[self.next_page, limit)stays disjoint fromself.pagesand subsequent smallertake(1)allocations cannot hand out an already-live page number.page_numbers_freed_are_given_again_past_the_title_s_21_bitswith a regression test covering afree_runspan that straddlesself.next_pagefollowed bytake_in(..., 1).Verified locally:
xtask policy:294 files okxtasktests:6 passed; 0 failedclippy --workspace --all-targets -- -D warnings: 0 warningsclippy --workspace --all-targets --features diagnostics -- -D warnings: 0 warningsvictory-hle xmem:22 passed; 0 failed; 1 ignoredvictory-hle --lib:183 passed; 0 failed; 3 ignored