Repository navigation
HLE reuses freed physical page numbers - #1445
BaggyALPHA wants to merge 3 commits into
Conversation
|
Tested on AMD (RDNA3) together with #431, to see whether this PR removes the one GPU page fault that remains there. In three runs it did not. Setup: AMD Radeon RX 7900 XTX 24 GB, driver 32.0.32029.2010; Ryzen 7 9800X3D, 32 GB; Windows 11 10.0.26300. Diag build of Background: with #431 alone, faults inside freed textures are gone on this GPU (#431 (comment)). What is left is a page fault where DRED names no resource.
AI use: Claude Code (Claude Opus 5.5) merged and built the commits, ran the title, summarised the log lines and wrote this comment. The numbers come from the runs above. |
|
Automated triage for the maintainers. The rebased head merges cleanly. In Reply to the author: thanks for the rebase. I reviewed the current head Generated by Claude Code |
|
Follow-up for the triage concern: Windows HLE library tests: 96 passed with default parallel scheduling. Strict Clippy with all targets and features, and the pre-commit asset-policy check, passed. Inputs were synthetic. No game run or relationship to the GPU page fault is claimed. AI-assisted (OpenAI Codex). |
|
Pre-merge concern worth a maintainer's eyes, found while investigating #2025: I have not demonstrated this actually happens — it would need either a live repro with real page churn (I attempted one for #2025 and didn't get far enough on NVIDIA hardware before hitting the unrelated world-hang device-removal) or a synthetic concurrency test exercising both crates together. Flagging it so it's weighed before merge rather than discovered after; happy to help verify if useful. AI-assisted (Claude Code). |
|
Withdrawing my own pre-merge concern above: page-number reuse cannot reach the I flagged that this PR's free-list reuse would be the first thing to make The gap is real, and reporting the mapping is what closes it. A synthetic test in
So the caveat is exactly as the module describes, and the runtime's own mapping report is the thing that closes it. Why reuse cannot trigger it. The gap needs the bytes behind an already-tracked address to change with no report. Reuse does not do that:
So the sequence I was worried about (reuse, then a tracker missing the new owner's writes) needs a mapping step, and that step reports itself. What I ran. Two notes in the interest of completeness:
AI-assisted (Claude Code); the numbers are from the runs described. |
a2defb2 to
3f88d1f
Compare
|
Rebased onto current One conflict, in On the rebased head: Nothing about the change itself is different — it is the same allocator, the same two tests, and the in-process limit test from the earlier follow-up. The concern I raised and then withdrew about page-number reuse reaching AI-assisted (Claude Code). |
…s run out The title keeps a page number as 21-bit `number >> 4`, so numbers must stay below 2^25; ours only counted up, from 0x100000, so after about 126 GiB of allocations over a run the numbers would no longer fit and the title would rebuild wrong ones. Freed numbers now come back, but only when no fresh number fits, and the longest freed first: a number the title still holds after freeing it (a DirectStorage request that reads its page list late) then reaches no page or one handed out long after, not the next allocation. A request that cannot get all its numbers gets none (count 0) before its sections are made; a number freed twice comes back once. After Marvisak/VIctory pull request Marvisak#1445 (BaggyALPHA; duplicate Marvisak#1935), which hands freed numbers out first; fitted here to the sections of VICTORY_SECTION_MB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses item 36 (VIC-BT-036) in #1249. The allocator now reuses freed page numbers and refuses a request if it cannot fit every number into the title's existing 21-bit field. A repeated free cannot add the same number twice. Existing mappings still refer to their original section when a number is reused for a new section.
I seeded the allocator just below the limit in an isolated test process and used the public allocation and free functions. Upstream returned an unrepresentable number on the second allocation despite the first having been freed. The patch reused the freed number. The regression also checks exhaustion with a live allocation, a duplicate free, and an old mapped view keeping its bytes after reuse. All 96 HLE tests, Clippy with all targets and features, and the asset-policy hook passed on Windows.
The follow-up checks the page-count limit before calculating the section size, so oversized requests clear the output count and leave the page array untouched. The synthetic regression now exercises allocation, mapping, aliasing, and physical writes at the limit. After reuse, the old mapping and an alias made from it retain their data, and writes by page number reach the new allocation. The oversized-request assertion failed before the follow-up and passes with it. Windows HLE tests (96), all-targets/all-features HLE Clippy, and the pre-commit asset-policy check passed.
AI-assisted (Codex).