XMem: title-placed reservations are write-watched only when asked for (Series S boot, #3023) #3126

Open
TheSovietWaffle wants to merge 1 commit from upstream-pr/3126 into main
TheSovietWaffle commented 2026-11-29 20:08:41 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by TheSovietWaffle on 2026-11-29T20:08:41Z.


Addresses #3023. The kernel stall itself is not explained here; this removes it from the default path and keeps the title-placed watch testable.

What it changes

78324212 gave title-placed reservations MEM_WRITE_WATCH by default. On the Series S the title's 3977 MB pool at 0x2000000000 goes through VirtualAlloc2 with that watch and never returns, so the profile hangs before the menu, the thread stays in the kernel, and the process cannot be killed. The reporter in #3023 bisected it to that commit and booted a build with watch_placement forced to false (a one-line change); that is the evidence this change is built on.

Comparing the last good build, v2026.11.28.03, with main, the write-watch change in xmem.rs is this branch: .28.03 watched only host-placed allocations (if constrained { ... kind |= MEM_WRITE_WATCH }). Unset now restores exactly that, and the switch keeps the newer path available.

This makes that path opt-in instead of default:

  • VICTORY_WATCH_PLACED_XMEM=1: ask for the watch, as v2026.11.29.02 did, so the title-placed path can keep being tested.
  • Unset (the default): placed reservations are not watched. Host-placed reservations (MEM_ADDRESS_REQUIREMENTS) are still watched exactly as before, a placeholder is still never watched, and a MEM_WRITE_WATCH the title asked for itself is still honoured.
  • The decision is a unit-tested function, can_watch_placement; the switch is read once through a OnceLock, like VICTORY_WATCH_LARGE_XMEM beside it.

Nothing else changes: the existing fallback for a refused watch, the "XMemVirtualAlloc without write watching" line, and all host-placed watching stay as they were. Series X is unaffected, because its pool is placed by us, on the constrained path.

I considered limiting the watch by size instead (the hang is on the 3977 MB pool, the earlier 82 MB placements went through), but the cause is not understood, so a threshold would be a guess about which sizes are safe. Off by default is the conservative choice, and the switch leaves the experiment available.

How it was tested

  • New test a_placed_reservation_is_watched_only_when_asked_for: a placed reservation is watched only when the switch asks for it, never through the host-placed path, never for placeholders, and the title's own MEM_WRITE_WATCH still passes. It passes.
  • cargo build --release --locked -p victory: finishes, same warnings as main.
  • cargo clippy -p victory-hle --lib: no finding in xmem.rs (the crate's other warnings are on main, unchanged).
  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): smoke-tested with the title (Windows 10 19045, RTX 3080, fresh cache/data, default switches): Series S boots, allocates the 3977 MB pool, starts 8 pipeline workers and runs to frame ~5,700 with no errors. This is not a differential test: in that run the big pool was host-placed (asked_at=0x0), so the title-placed watch path of #3023 was never taken; the evidence for the fix remains the reporter's build with the same effective change (watch off) booting the profile, quoted in #3023. A build from this branch with the switch unset is the missing step; with VICTORY_WATCH_PLACED_XMEM=1 the hang should come back, which is the knob for whoever wants to chase the kernel call.
  • cargo test -p victory-hle --lib modules::xmem: 46 passed, 1 failed: a_read_by_range_waits_only_for_a_remapping_that_meets_it, the known parallel-run flake of #2420 item 2 (PR #2439). It passes when run alone, and it does not touch this path.

Checked for overlap

  • I searched the open pull requests for #3023 and for watch_placement: none touches this code. Related: #2048 and #3086 (diagnostics build), #2792 (first Clippy gate), #2439 (the xmem flake above); none changes xmem.rs's placement watching.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5554620320 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3126). Originally posted by [TheSovietWaffle](https://github.com/TheSovietWaffle) on 2026-11-29T20:08:41Z. --- Addresses #3023. The kernel stall itself is not explained here; this removes it from the default path and keeps the title-placed watch testable. ## What it changes `78324212` gave title-placed reservations `MEM_WRITE_WATCH` by default. On the Series S the title's 3977 MB pool at `0x2000000000` goes through `VirtualAlloc2` with that watch and never returns, so the profile hangs before the menu, the thread stays in the kernel, and the process cannot be killed. The reporter in #3023 bisected it to that commit and booted a build with `watch_placement` forced to `false` (a one-line change); that is the evidence this change is built on. Comparing the last good build, v2026.11.28.03, with `main`, the write-watch change in `xmem.rs` is this branch: `.28.03` watched only host-placed allocations (`if constrained { ... kind |= MEM_WRITE_WATCH }`). Unset now restores exactly that, and the switch keeps the newer path available. This makes that path opt-in instead of default: - `VICTORY_WATCH_PLACED_XMEM=1`: ask for the watch, as v2026.11.29.02 did, so the title-placed path can keep being tested. - Unset (the default): placed reservations are not watched. Host-placed reservations (`MEM_ADDRESS_REQUIREMENTS`) are still watched exactly as before, a placeholder is still never watched, and a `MEM_WRITE_WATCH` the title asked for itself is still honoured. - The decision is a unit-tested function, `can_watch_placement`; the switch is read once through a `OnceLock`, like `VICTORY_WATCH_LARGE_XMEM` beside it. Nothing else changes: the existing fallback for a refused watch, the "XMemVirtualAlloc without write watching" line, and all host-placed watching stay as they were. Series X is unaffected, because its pool is placed by us, on the `constrained` path. I considered limiting the watch by size instead (the hang is on the 3977 MB pool, the earlier 82 MB placements went through), but the cause is not understood, so a threshold would be a guess about which sizes are safe. Off by default is the conservative choice, and the switch leaves the experiment available. ## How it was tested - New test `a_placed_reservation_is_watched_only_when_asked_for`: a placed reservation is watched only when the switch asks for it, never through the host-placed path, never for placeholders, and the title's own `MEM_WRITE_WATCH` still passes. It passes. - `cargo build --release --locked -p victory`: finishes, same warnings as `main`. - `cargo clippy -p victory-hle --lib`: no finding in `xmem.rs` (the crate's other warnings are on `main`, unchanged). - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): smoke-tested with the title (Windows 10 19045, RTX 3080, fresh cache/data, default switches): Series S boots, allocates the 3977 MB pool, starts 8 pipeline workers and runs to frame ~5,700 with no errors. **This is not a differential test**: in that run the big pool was host-placed (`asked_at=0x0`), so the title-placed watch path of #3023 was never taken; the evidence for the fix remains the reporter's build with the same effective change (watch off) booting the profile, quoted in #3023. A build from this branch with the switch unset is the missing step; with `VICTORY_WATCH_PLACED_XMEM=1` the hang should come back, which is the knob for whoever wants to chase the kernel call. - `cargo test -p victory-hle --lib modules::xmem`: 46 passed, 1 failed: `a_read_by_range_waits_only_for_a_remapping_that_meets_it`, the known parallel-run flake of #2420 item 2 (PR #2439). It passes when run alone, and it does not touch this path. ## Checked for overlap - [x] I searched the open pull requests for #3023 and for `watch_placement`: none touches this code. Related: #2048 and #3086 (diagnostics build), #2792 (first Clippy gate), #2439 (the xmem flake above); none changes `xmem.rs`'s placement watching.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3126:upstream-pr/3126'
git switch 'upstream-pr/3126'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3126'
git switch 'upstream-pr/3126'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3126'
git switch 'upstream-pr/3126'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3126'
git switch 'main'
git merge --squash 'upstream-pr/3126'
git switch 'main'
git merge --ff-only 'upstream-pr/3126'
git switch 'main'
git merge 'upstream-pr/3126'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!3126
No description provided.