xmem: commit physical pages in pieces, and report the real count #561
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/561"
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 Marvisak/VIctory. Originally posted by JoshRob297 on 2026-11-24T04:56:26Z.
Addresses #23.
A title that asks for a large block of physical pages fails outright when the host cannot commit all of it at once. The console ABI does not promise one contiguous commitment: the request carries a page count, the title compares what it got, and a host can commit what it allows in pieces and report the real count instead of failing the whole call.
What this changes (
crates/victory-hle/src/modules/xmem.rs)Verification
That is a type-check against the target this project pins in
rust-toolchain.toml, not a run: the change is in the physical-page path and has not been exercised against a title.What it does not fix
If the title requires the full reservation contiguously — as opposed to asking for a count and comparing — this does not help, and the way to tell is to log the count the title asks for against the count the host can commit. I have not measured that on the failing machine.
Provenance
The measurement this rests on comes from static analysis of the retail executable's allocation call sites (flag word, 64 KiB unit, and one call site that compares the returned page count), not from the source of this project. No game data is included here: no paths, no container names, no hashes.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T12:44:29Z.
Review: COMMENTED
Test-merge with current main (
ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touchedlower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T17:52:59Z.
Verification ran against PR head
3c02d8cf89470f487bab9c3a207da75084aca8b2; the PR was open at refresh.cargo test -j 1 -p victory-hle xmem::tests: 6 passed, 1 failed:modules::xmem::tests::allocated_physical_pages_are_committed.cargo test -j 1 -p victory-hle xmem::tests -- --test-threads=1: the same 6 passed and 1 failed, so the failure reproduces without parallel test interference.The failure is at
xmem.rs:1112:VirtualFree(reserve, 0, MEM_RELEASE)returns 0. The test maps pages into the reservation, then callsXMemFreePhysicalPages, which removes the page-number records but does not unmap the view.XMemMapPhysicalPageswith null pages is the unmap path; the test needs to unmap before releasing the reservation.commits_across_a_piece_boundaryand the other five xmem tests pass. The focused tests cover the 64-MiB commit boundary and a 4-page allocation, but do not simulate host commit-limit exhaustion or a short allocation.This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:25:43Z.
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-hle/src/modules/xmem.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T03:13:14Z.
Triage verdict — Rebase and verify short allocations (
3c02d8c)Evidence
3c02d8cis charging pages at allocation time and returning a short count.SEC_COMMITunder Wine to avoid repeated wineserver scans.Checks and limits
940d32f,cargo test -p victory-hle commit_limit_report_includes_request_and_system_commitpassed with synthetic inputs. That verifies the diagnostic text; it does not force a host allocation failure.Next step
commitconflict, and test a deterministic partial commit before calling it ready. The acceptance case should assert the returned count, which page IDs can still be mapped, and what happens when nothing can be committed.SEC_RESERVEand piece commits.This verification was AI-assisted.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.