kernelx: unmark lazy away mappings in FreeTitlePhysicalPages #1212

Merged
b3IKK merged 1 commit from upstream-pr/1221 into main 2026-11-30 09:21:06 +00:00
b3IKK commented 2026-11-24 13:22:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T13:22:13Z.


When a fresh physical page is mapped into a plain MEM_RESERVE region via MapTitlePhysicalPages, map_pages marks that address in lazy::LAZY. Both unmap_away and move_away call lazy::unmark(at), but FreeTitlePhysicalPages removed the entry from AWAY without unmarking it—leaving a stale entry in lazy::LAZY that could silently commit the address (even after VirtualFree and VA reuse) on a later lazy::ensure or page fault, and could also cause silent data loss when another page B is later mapped at r, written, and mapped back home (unmap_away(r) returns early on the stale lazy::unmark(r) without copying r back to B's home).

This calls lazy::unmark(at) when FreeTitlePhysicalPages removes an away mapping.

What is in it

  • crates/xcl/src/hle/kernelx.rs: call lazy::unmark(at) when removing an away mapping in FreeTitlePhysicalPages; add regression tests free_physical_pages_unmarks_lazy_away_mapping and free_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes.

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 743 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 no wave64 — gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)
  • cargo test -p xcl --lib free_physical_pages_: 2 passed, 0 failed

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1226 (PresentX 1226)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15341 MB

PR:

xcl-smoke v1
commit: 34035fc1b010450d4c2cb04835fd03c01aabb8fc
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1640 (PresentX 1640)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14479 MB

Not tested

  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: audited kernelx.rs, wrote the fix and regression tests (including the data-loss sequence suggested in review), ran the test suite and scripts/smoke.ps1 regression runs, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5472958719 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T13:22:13Z. --- When a fresh physical page is mapped into a plain `MEM_RESERVE` region via `MapTitlePhysicalPages`, `map_pages` marks that address in `lazy::LAZY`. Both `unmap_away` and `move_away` call `lazy::unmark(at)`, but `FreeTitlePhysicalPages` removed the entry from `AWAY` without unmarking it—leaving a stale entry in `lazy::LAZY` that could silently commit the address (even after `VirtualFree` and VA reuse) on a later `lazy::ensure` or page fault, and could also cause silent data loss when another page B is later mapped at `r`, written, and mapped back home (`unmap_away(r)` returns early on the stale `lazy::unmark(r)` without copying `r` back to B's home). This calls `lazy::unmark(at)` when `FreeTitlePhysicalPages` removes an away mapping. **What is in it** - `crates/xcl/src/hle/kernelx.rs`: call `lazy::unmark(at)` when removing an away mapping in `FreeTitlePhysicalPages`; add regression tests `free_physical_pages_unmarks_lazy_away_mapping` and `free_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes`. **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 743 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 `no wave64` — `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`) - `cargo test -p xcl --lib free_physical_pages_`: 2 passed, 0 failed **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1226 (PresentX 1226) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15341 MB ``` PR: ``` xcl-smoke v1 commit: 34035fc1b010450d4c2cb04835fd03c01aabb8fc gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1640 (PresentX 1640) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14479 MB ``` **Not tested** - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Gemini 4 Neon: audited `kernelx.rs`, wrote the fix and regression tests (including the data-loss sequence suggested in review), ran the test suite and `scripts/smoke.ps1` regression runs, and drafted this PR description.
DavidM1911 commented 2026-11-24 14:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:47:21Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib kernelx: 33 passed, 0 failed.

Note: the full d3d12x lib filter currently aborts with 0xc0000005 on unmodified main too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.

<!-- greyfinch-sync:ivall/xcl:comment:7133338420 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1221#issuecomment-7133338420). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T13:47:21Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib kernelx: 33 passed, 0 failed. Note: the full `d3d12x` lib filter currently aborts with 0xc0000005 on unmodified `main` too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.
pvfreis commented 2026-11-24 15:05:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T14:23:41Z.


The fix is right, and on main (930e8b4) the stale mark does more than commit r later: it loses data. Read only; nothing built or run here. Sequence, all in kernelx.rs on main:

  1. A never-used page A is mapped at a reservation r away from home: lazy::mark(r) (:1284-1287). FreeTitlePhysicalPages([A]) drops the mapping but not the mark (:1169-1175).
  2. Page B is mapped home and written, then mapped at r: r is committed and B's home is copied to it (:1290-1296); the home is given back at the end of the call. r is committed, so nothing faults and the mark stays.
  3. The title writes at r, then maps B home again: commit_homes brings the home back as zeros, and unmap_away(r) returns early because lazy::unmark(r) is true (:1061-1066), so r is never copied home. B reads zeros.

A test of that sequence (assert B's home holds what was written at r) fails on main and should pass with the one-line fix here, which would cover the data loss as well as the stray commit your test checks.

Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7134301767 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1221#issuecomment-7134301767). Originally posted by [pvfreis](https://github.com/pvfreis) on 2026-11-24T14:23:41Z. --- The fix is right, and on `main` (`930e8b4`) the stale mark does more than commit `r` later: it loses data. Read only; nothing built or run here. Sequence, all in `kernelx.rs` on `main`: 1. A never-used page A is mapped at a reservation `r` away from home: `lazy::mark(r)` (`:1284-1287`). `FreeTitlePhysicalPages([A])` drops the mapping but not the mark (`:1169-1175`). 2. Page B is mapped home and written, then mapped at `r`: `r` is committed and B's home is copied to it (`:1290-1296`); the home is given back at the end of the call. `r` is committed, so nothing faults and the mark stays. 3. The title writes at `r`, then maps B home again: `commit_homes` brings the home back as zeros, and `unmap_away(r)` returns early because `lazy::unmark(r)` is true (`:1061-1066`), so `r` is never copied home. B reads zeros. A test of that sequence (assert B's home holds what was written at `r`) fails on `main` and should pass with the one-line fix here, which would cover the data loss as well as the stray commit your test checks. Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.
b3IKK commented 2026-11-24 19:07:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T18:54:05Z.


Great catch @pvfreis — added \ ree_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes\ in \34035fc\ covering that exact page A -> free -> page B away write -> map home data-loss sequence, and re-ran \scripts/test.ps1\ and the 60 s \scripts/smoke.ps1\ run.

<!-- greyfinch-sync:ivall/xcl:comment:7141310338 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7141310338). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T18:54:05Z. --- Great catch @pvfreis — added \ ree_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes\ in \34035fc\ covering that exact page A -> free -> page B away write -> map home data-loss sequence, and re-ran \scripts/test.ps1\ and the 60 s \scripts/smoke.ps1\ run.
DavidM1911 commented 2026-11-26 04:07:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:05:33Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7182286307 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7182286307). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T04:05:33Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
oni-swr commented 2026-11-26 19:12:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T19:12:49Z.


AMD Windows test report for head 34035fc1b010450d4c2cb04835fd03c01aabb8fc (exact head, clean detached checkout, no local changes). Base: main 47efa2ecea0a12934719ae69b81930cf02a4b1c3 (the merge base; the PR is not merged with current main).

Tested

  • AMD Radeon RX 7800 XT (RDNA3, driver 32.0.31035.1003), Ryzen 7 5700X3D, 64 GB, Windows 11 25H2 (26200), Rust 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (Windows Kit 10.0.26100.0). XCL_ADAPTER unset, so the physical GPU was used, not WARP. Own target dir, rebuilt from scratch for this head.
  • cargo build --workspace -j 4: ok.
  • cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --nocapture (debug): 743 passed, 0 failed, 41 ignored over 19 test binaries. No SKIPPED test line. kernelx::tests::free_physical_pages_unmarks_lazy_away_mapping and free_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes are among the passes. At this head the tree has no fuzz_tests, so the known AMD fuzz failure (#2115) does not come up.
  • 60 s smoke (scripts/smoke.ps1 of each commit, release builds, title run from a local copy): base 47efa2e twice (the first run filled the shader cache), then this head. Peak commit and frames:
run frames shown peak commit removals / crashes
base 47efa2e, run 1 (cold cache) 1417 17451 MB 0 / 0
this head 34035fc 1493 17707 MB 0 / 0
base 47efa2e, run 2 (warm cache) 1437 18344 MB 0 / 0
xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 7800 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1437 (PresentX 1438)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18344 MB
xcl-smoke v1
commit: 34035fc1b010450d4c2cb04835fd03c01aabb8fc
gpu: AMD Radeon RX 7800 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1493 (PresentX 1494)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17707 MB

The older smoke.ps1 at these commits prints the folder name as title:; I replaced it with retail-title in the blocks above and changed nothing else.

Not tested

  • The merge with current main (8b957bec): the suite and the smoke ran on this head and its merge base only.
  • Whether the title ever frees physical pages with a stale lazy mark during the 60 s: the smoke is a regression check, it does not show the changed path being hit.
  • NVIDIA, Intel, Linux/Wine, AMD RDNA2/RDNA4. One run per row of the smoke table.

AI use: Claude Code (Claude Sonnet 5.5) ran the tests and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7201319695 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7201319695). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T19:12:49Z. --- AMD Windows test report for head `34035fc1b010450d4c2cb04835fd03c01aabb8fc` (exact head, clean detached checkout, no local changes). Base: `main` `47efa2ecea0a12934719ae69b81930cf02a4b1c3` (the merge base; the PR is not merged with current `main`). **Tested** - AMD Radeon RX 7800 XT (RDNA3, driver 32.0.31035.1003), Ryzen 7 5700X3D, 64 GB, Windows 11 25H2 (26200), Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, DXC 1.8.2502.11 (Windows Kit 10.0.26100.0). `XCL_ADAPTER` unset, so the physical GPU was used, not WARP. Own target dir, rebuilt from scratch for this head. - `cargo build --workspace -j 4`: ok. - `cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --nocapture` (debug): **743 passed, 0 failed, 41 ignored** over 19 test binaries. No `SKIPPED` test line. `kernelx::tests::free_physical_pages_unmarks_lazy_away_mapping` and `free_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes` are among the passes. At this head the tree has no `fuzz_tests`, so the known AMD fuzz failure (#2115) does not come up. - 60 s smoke (`scripts/smoke.ps1` of each commit, release builds, title run from a local copy): base `47efa2e` twice (the first run filled the shader cache), then this head. Peak commit and frames: | run | frames shown | peak commit | removals / crashes | |---|---|---|---| | base `47efa2e`, run 1 (cold cache) | 1417 | 17451 MB | 0 / 0 | | this head `34035fc` | 1493 | 17707 MB | 0 / 0 | | base `47efa2e`, run 2 (warm cache) | 1437 | 18344 MB | 0 / 0 | ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 7800 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1437 (PresentX 1438) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18344 MB ``` ``` xcl-smoke v1 commit: 34035fc1b010450d4c2cb04835fd03c01aabb8fc gpu: AMD Radeon RX 7800 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1493 (PresentX 1494) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17707 MB ``` The older `smoke.ps1` at these commits prints the folder name as `title:`; I replaced it with `retail-title` in the blocks above and changed nothing else. **Not tested** - The merge with current `main` (`8b957bec`): the suite and the smoke ran on this head and its merge base only. - Whether the title ever frees physical pages with a stale lazy mark during the 60 s: the smoke is a regression check, it does not show the changed path being hit. - NVIDIA, Intel, Linux/Wine, AMD RDNA2/RDNA4. One run per row of the smoke table. **AI use:** Claude Code (Claude Sonnet 5.5) ran the tests and drafted this report.
upipibi commented 2026-11-26 20:41:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T20:41:02Z.


NVIDIA report, exact head 34035fc1b010450d4c2cb04835fd03c01aabb8fc, merge-base 47efa2ecea0a12934719ae69b81930cf02a4b1c3. RTX 3070 8 GB (Ampere, wave32), driver 616.56, Windows 11, rustc 1.100.0.

  • cargo test -p xcl --lib hle::kernelx::tests::free_physical_pages -- --test-threads=1 x3: head 2 passed (the two new free_physical_pages tests) 3/3 runs; merge-base 0 tests, neither exists there, so no control.
  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4: head 691 passed, 0 failed, 21 ignored; merge-base 689 passed, 0 failed, 21 ignored.
  • SKIPPED, same on both: 2 wave64.
  • The full d3d12x filter was not run (it aborts on main per DavidM1911); kernelx tests were run by name.
  • No nvlddmkm resets.

AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).

<!-- greyfinch-sync:ivall/xcl:comment:7202967716 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7202967716). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T20:41:02Z. --- NVIDIA report, exact head `34035fc1b010450d4c2cb04835fd03c01aabb8fc`, merge-base `47efa2ecea0a12934719ae69b81930cf02a4b1c3`. RTX 3070 8 GB (Ampere, wave32), driver 616.56, Windows 11, rustc 1.100.0. - `cargo test -p xcl --lib hle::kernelx::tests::free_physical_pages -- --test-threads=1` x3: head 2 passed (the two new free_physical_pages tests) 3/3 runs; merge-base 0 tests, neither exists there, so no control. - `cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4`: head 691 passed, 0 failed, 21 ignored; merge-base 689 passed, 0 failed, 21 ignored. - SKIPPED, same on both: 2 wave64. - The full d3d12x filter was not run (it aborts on main per DavidM1911); kernelx tests were run by name. - No nvlddmkm resets. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Decodere commented 2026-11-27 10:45:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T10:45:30Z.


Independent desktop NVIDIA verification of PR #1221 at head 34035fc1b010450d4c2cb04835fd03c01aabb8fc (1 commit; exact parent & merge-base: 47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted tests & build (34035fc1)

Command Result
cargo test --release -p xcl --lib -- --nocapture free_physical_pages_unmarks_lazy_away_mapping free_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes (3 consecutive runs) 2 passed; 0 failed; 0 ignored; 719 filtered out × 3 (0.02s, 0.02s, 0.02s, 0 skipped)
cargo test --release -p xcl --lib hle::kernelx:: -- --nocapture (3 consecutive runs) 33 passed; 0 failed; 1 ignored; 687 filtered out × 3 (0.21s, 0.19s, 0.20s, 0 runtime skips; 1 pre-existing #[ignore] timing test scatter_timing)
cargo build --release -p xcl Clean build (54.70s, exit 0, 0 new warnings in kernelx.rs)

Paired quiet 60 s retail smoke (title: 29640639)

(Note: scripts/smoke.ps1 at 47efa2ec predates 9683e7a6 and printed the local folder basename on title:; replaced below with the standard 9683e7a6 title hash 29640639, with all measured fields verbatim.)

Exact parent & merge-base (47efa2ecea0a12934719ae69b81930cf02a4b1c3):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1527 (PresentX 1527)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14723 MB

PR #1221 (34035fc1b010450d4c2cb04835fd03c01aabb8fc):

xcl-smoke v1
commit: 34035fc1b010450d4c2cb04835fd03c01aabb8fc
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1599 (PresentX 1599)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14706 MB

Limits of coverage

  • Both new FreeTitlePhysicalPages lazy-away-mapping regression tests and the full hle::kernelx:: suite (33/33 active tests, 0 runtime skips) passed 3/3 on Windows 11.
  • The 60 s retail smoke confirms steady 60 Hz runtime non-regression (0 device removals, 0 crashes); single-run frame/commit delta vs. parent reflects normal startup variance rather than this PR.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7216269058 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7216269058). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T10:45:30Z. --- Independent desktop NVIDIA verification of **PR #1221** at head `34035fc1b010450d4c2cb04835fd03c01aabb8fc` (`1` commit; exact parent & merge-base: `47efa2ecea0a12934719ae69b81930cf02a4b1c3`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted tests & build (`34035fc1`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib -- --nocapture free_physical_pages_unmarks_lazy_away_mapping free_physical_pages_stale_lazy_mark_does_not_lose_reused_reservation_writes` (3 consecutive runs) | `2 passed; 0 failed; 0 ignored; 719 filtered out` × 3 (`0.02s`, `0.02s`, `0.02s`, `0` skipped) | | `cargo test --release -p xcl --lib hle::kernelx:: -- --nocapture` (3 consecutive runs) | `33 passed; 0 failed; 1 ignored; 687 filtered out` × 3 (`0.21s`, `0.19s`, `0.20s`, `0` runtime skips; `1` pre-existing `#[ignore]` timing test `scatter_timing`) | | `cargo build --release -p xcl` | Clean build (`54.70s`, exit `0`, `0` new warnings in `kernelx.rs`) | ### Paired quiet 60 s retail smoke (`title: 29640639`) *(Note: `scripts/smoke.ps1` at `47efa2ec` predates `9683e7a6` and printed the local folder basename on `title:`; replaced below with the standard `9683e7a6` title hash `29640639`, with all measured fields verbatim.)* Exact parent & merge-base (`47efa2ecea0a12934719ae69b81930cf02a4b1c3`): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1527 (PresentX 1527) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14723 MB ``` PR #1221 (`34035fc1b010450d4c2cb04835fd03c01aabb8fc`): ``` xcl-smoke v1 commit: 34035fc1b010450d4c2cb04835fd03c01aabb8fc gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1599 (PresentX 1599) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14706 MB ``` ### Limits of coverage - Both new `FreeTitlePhysicalPages` lazy-away-mapping regression tests and the full `hle::kernelx::` suite (`33/33` active tests, `0` runtime skips) passed `3/3` on Windows 11. - The 60 s retail smoke confirms steady 60 Hz runtime non-regression (`0` device removals, `0` crashes); single-run frame/commit delta vs. parent reflects normal startup variance rather than this PR. *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
tiagonleal commented 2026-11-30 03:55:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T03:55:10Z.


merge-check
base: f97120dc19
head: 34035fc1b0
merge: clean
build: cargo build --workspace -> ok (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2843 passed, 0 failed, 51 ignored; SKIPPED: 24 lines (22 no wave64, 2 no heap windows), the same as on the base; failing: none. Base alone on this PC: 2841 passed, 0 failed, 51 ignored. The two new tests ran here and are real regression tests on this machine: with the added lazy::unmark(at); line commented out in the merged tree, cargo test -p xcl --lib hle::kernelx::tests::free_physical_pages -- --test-threads=1 fails both (freed away-mapped page must not remain in lazy::LAZY and stale lazy mark must not drop writes on B); with the line, 2 passed.
review: whole diff read (+64/-0, kernelx.rs). One line of fix: FreeTitlePhysicalPages now drops the lazy mark of the away address of each page it frees. Still needed on current main: the only other lazy::unmark calls are in unmap_away and move_away, which the free path does not go through. It takes the lazy set after the away lock, the order those two functions use, and a page that was never lazy is a no-op. Two notes, neither a blocker. Both tests return without a SKIPPED line when the page home is not sparse, so on such a machine they pass without testing anything (they did test here, see above). And open #2004 rewrites the same function with a batched unmark, so the second of the two to merge needs a rebase.
performance: one set removal per freed away page. Measured with scripts/smoke.ps1, 60 s of a retail title, release: 1678 frames and 15943 MB peak commit against 1635 and 1680 frames, 15366 and 16673 MB on the base (run before and after). No device removal, no crash.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Fable 5.2 ran the build, suite, tests and smoke and wrote this; Claude Opus 5.5 read the diff first, and I checked its main points in the merged source)

  • Tiago
<!-- greyfinch-sync:ivall/xcl:comment:7268309650 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7268309650). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T03:55:10Z. --- merge-check base: f97120dc196ca05e7f47e919d3675f7d5a2b478a head: 34035fc1b010450d4c2cb04835fd03c01aabb8fc merge: clean build: cargo build --workspace -> ok (also `cargo build --release -p xcl`) tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2843 passed, 0 failed, 51 ignored; SKIPPED: 24 lines (22 `no wave64`, 2 `no heap windows`), the same as on the base; failing: none. Base alone on this PC: 2841 passed, 0 failed, 51 ignored. The two new tests ran here and are real regression tests on this machine: with the added `lazy::unmark(at);` line commented out in the merged tree, `cargo test -p xcl --lib hle::kernelx::tests::free_physical_pages -- --test-threads=1` fails both (`freed away-mapped page must not remain in lazy::LAZY` and `stale lazy mark must not drop writes on B`); with the line, 2 passed. review: whole diff read (+64/-0, `kernelx.rs`). One line of fix: `FreeTitlePhysicalPages` now drops the lazy mark of the away address of each page it frees. Still needed on current `main`: the only other `lazy::unmark` calls are in `unmap_away` and `move_away`, which the free path does not go through. It takes the lazy set after the away lock, the order those two functions use, and a page that was never lazy is a no-op. Two notes, neither a blocker. Both tests return without a `SKIPPED` line when the page home is not sparse, so on such a machine they pass without testing anything (they did test here, see above). And open #2004 rewrites the same function with a batched unmark, so the second of the two to merge needs a rebase. performance: one set removal per freed away page. Measured with `scripts/smoke.ps1`, 60 s of a retail title, release: 1678 frames and 15943 MB peak commit against 1635 and 1680 frames, 15366 and 16673 MB on the base (run before and after). No device removal, no crash. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Fable 5.2 ran the build, suite, tests and smoke and wrote this; Claude Opus 5.5 read the diff first, and I checked its main points in the merged source) - Tiago
brainhay5 commented 2026-11-30 05:24:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T05:24:26Z.


merge-check claim
head: 34035fc1b0

<!-- greyfinch-sync:ivall/xcl:comment:7269638121 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7269638121). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-30T05:24:26Z. --- merge-check claim head: 34035fc1b010450d4c2cb04835fd03c01aabb8fc
brainhay5 commented 2026-11-30 05:32:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T05:32:46Z.


merge-check
base: d52ff48caa
head: 34035fc1b0
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2877 passed, 2 failed, 51 ignored; 29 SKIPPED lines

failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017

correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base". gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 fails on base d52ff48c by itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.

<!-- greyfinch-sync:ivall/xcl:comment:7269769370 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7269769370). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-30T05:32:46Z. --- merge-check base: d52ff48caade1f5350d513bfffd370396dadfeb6 head: 34035fc1b010450d4c2cb04835fd03c01aabb8fc merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2877 passed, 2 failed, 51 ignored; 29 SKIPPED lines failing: test_title_runs_and_game_folder_is_untouched review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review. performance: not assessed beyond the suite. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017 correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base". `gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16` fails on base d52ff48c by itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.
Elytes commented 2026-11-30 08:24:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Elytes on 2026-11-30T08:24:30Z.


merge-check
base: d52ff48caa
head: 34035fc1b0
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2877 passed, 2 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no heap windows, 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 driver cache needs Developer Mode); failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 and hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory, both also fail on the base alone (full lib run and isolated: base lib 2732 passed / 2 failed, merge lib 2734 passed / 2 failed, the +2 being this PR's tests)
review: no blocking finding after reading the whole diff (1 file, +64: a one-line fix and two tests). The fix matches unmap_away / move_away, which already unmark. Both new tests fail with the one-line fix removed (free_physical_pages_unmarks_lazy_away_mapping at the commit check; the reuse test loses the 0xCAFEBABE write) and pass with it, so they exercise the bug on this machine. Minor, not blocking: once a never-touched page is freed while still mapped at at, an access to at now faults instead of committing zeros, while a used page's address keeps its bytes (the comment above the loop says "that address keeps whatever it holds"); this only matters for a title touching memory whose page it freed. Overlap: #2004 (+1413/-257, conflicting) makes the same unmark inside a larger change (unmark_batch); this PR is the focused version. Another check on this PR reports gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 as added by it: that test fails on main itself (base d52ff48c lib 2732 passed / 2 failed, merge 2734 passed / 2 failed, the same two tests; the +2 are this PR's).
performance: no frame-time or memory cost by default: one BTreeSet removal under the lazy lock per freed page that is mapped away (reasoned, not measured).
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.1742, wave32), Intel Core i9-14900KS, 192 GB, Windows 11 build 26300.10075, rustc 1.92.0, debug / Claude Code (Claude Opus 5.5) ran the merge, build, suite, base reruns and the fix-removed run, searched for duplicates and reviewed the diff.

<!-- greyfinch-sync:ivall/xcl:comment:7272871030 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1221#issuecomment-7272871030). Originally posted by [Elytes](https://github.com/Elytes) on 2026-11-30T08:24:30Z. --- merge-check base: d52ff48caade1f5350d513bfffd370396dadfeb6 head: 34035fc1b010450d4c2cb04835fd03c01aabb8fc merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2877 passed, 2 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no heap windows, 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 driver cache needs Developer Mode); failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 and hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory, both also fail on the base alone (full lib run and isolated: base lib 2732 passed / 2 failed, merge lib 2734 passed / 2 failed, the +2 being this PR's tests) review: no blocking finding after reading the whole diff (1 file, +64: a one-line fix and two tests). The fix matches unmap_away / move_away, which already unmark. Both new tests fail with the one-line fix removed (free_physical_pages_unmarks_lazy_away_mapping at the commit check; the reuse test loses the 0xCAFEBABE write) and pass with it, so they exercise the bug on this machine. Minor, not blocking: once a never-touched page is freed while still mapped at `at`, an access to `at` now faults instead of committing zeros, while a used page's address keeps its bytes (the comment above the loop says "that address keeps whatever it holds"); this only matters for a title touching memory whose page it freed. Overlap: #2004 (+1413/-257, conflicting) makes the same unmark inside a larger change (`unmark_batch`); this PR is the focused version. Another check on this PR reports gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 as added by it: that test fails on main itself (base d52ff48c lib 2732 passed / 2 failed, merge 2734 passed / 2 failed, the same two tests; the +2 are this PR's). performance: no frame-time or memory cost by default: one BTreeSet removal under the lazy lock per freed page that is mapped away (reasoned, not measured). verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.1742, wave32), Intel Core i9-14900KS, 192 GB, Windows 11 build 26300.10075, rustc 1.92.0, debug / Claude Code (Claude Opus 5.5) ran the merge, build, suite, base reruns and the fix-removed run, searched for duplicates and reviewed the diff.
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
xcl-dev/xcl!1212
No description provided.