Tests: a failed page move commits nowhere another test can reserve (#1487) #1671

Open
github-bot wants to merge 1 commit from github-bot/gh-1671 into main AGit
Owner

@⁠Diskuss on GitHub · 2026-11-24 19:06 UTC · original
Diskuss:tests/kernelx-page-move-flake → main · +4 −3 · 1 files · 1 commits · draft

hle::kernelx::tests::a_page_whose_move_fails_stays_mapped_where_it_was failed once in a parallel run (reported in #1487), with assertion failed: move_away(&mut away, old, at, page, false).is_err().

The cause: to get "an address with nothing reserved", the test reserves 64 KiB and releases it again. In a parallel run, another test can reserve that address before move_away runs. The MEM_COMMIT then succeeds, move_away copies the page's 64 KiB over the other test's memory, and returns Ok, so the assert fails. The other test's memory is also overwritten, which can make that test fail too.

What is in it

  • crates/xcl/src/hle/kernelx.rs, test module only: the destination is now 0xFFFF_8000_0000_0000, a kernel-space address. A commit there always fails, and no thread can reserve it. move_away itself is unchanged.

Tested

  • AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.7029; Ryzen 7 5700X3D (16 logical CPUs); Windows 11 Pro build 26300.9974; Rust 1.100.0 x86_64-pc-windows-msvc; debug.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on this head: 858 passed, 0 failed, 42 ignored, the same as main c160d86. 1 SKIPPED printed (heap_window_out_of_memory_falls_back_to_the_switch_form); 2 debug-layer tests skip silently (no Graphics Tools installed). No device removal.
  • With this change, the lib test binary run directly:
    • the test alone, 20 runs: 20 passed;
    • the full lib suite at --test-threads=16 (the default here), 22 runs: 22 × 809 passed, 0 failed.
  • On main c160d86, the failure is rare on this machine: 1 of 3 earlier cargo test --workspace runs at default threads (#1487). In today's runs: 0 of 20 with the test alone, 0 of 10 full-lib runs at 16 threads, and 0 of 30 full-lib runs at 32 threads. So the zero above shows that the change breaks nothing, but it does not prove the flake is gone. The cause above is from reading the code.

Regression run

  • Run and posted by Toons29 in this comment (not on our machine): scripts/smoke.ps1 on the retail title, 60 s, release build, XCL_NETWORK=0, AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0. Blocks copied unchanged: main on 4178e888, this PR on its head commit with no uncommitted changes.
xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 85a743fdb3861bd15b1f3bd32a30f2f0c0363dc9
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1632 (PresentX 1632)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB
  • Against the limits in CONTRIBUTING.md: 1632 against 1618 frames (101 %), 14812 against 14831 MB peak commit, 0 crashes, 0 device removals. The diff is inside #[cfg(test)] mod tests only, so this run only shows that the build is unaffected; it does not reach the changed test.

Not tested

  • Retail title / scripts/smoke.ps1 on our machine (no game files); the regression run above is Toons29's. NVIDIA and Intel (but see the RTX 3060 Ti cargo test -p xcl --lib result from DavidM1911 in the comments).

AI use

  • Claude Code (Claude Opus 5.5): code, tests and description; reviewed by Diskuss.

🤖 Generated with Claude Code

**@⁠Diskuss** on GitHub · 2026-11-24 19:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1671) `Diskuss:tests/kernelx-page-move-flake` → `main` · +4 −3 · 1 files · 1 commits · draft `hle::kernelx::tests::a_page_whose_move_fails_stays_mapped_where_it_was` failed once in a parallel run (reported in #1487), with `assertion failed: move_away(&mut away, old, at, page, false).is_err()`. The cause: to get "an address with nothing reserved", the test reserves 64 KiB and releases it again. In a parallel run, another test can reserve that address before `move_away` runs. The `MEM_COMMIT` then succeeds, `move_away` copies the page's 64 KiB over the other test's memory, and returns `Ok`, so the assert fails. The other test's memory is also overwritten, which can make that test fail too. **What is in it** - `crates/xcl/src/hle/kernelx.rs`, test module only: the destination is now `0xFFFF_8000_0000_0000`, a kernel-space address. A commit there always fails, and no thread can reserve it. `move_away` itself is unchanged. **Tested** - AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.7029; Ryzen 7 5700X3D (16 logical CPUs); Windows 11 Pro build 26300.9974; Rust 1.100.0 x86_64-pc-windows-msvc; debug. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on this head: 858 passed, 0 failed, 42 ignored, the same as main `c160d86`. 1 SKIPPED printed (`heap_window_out_of_memory_falls_back_to_the_switch_form`); 2 debug-layer tests skip silently (no Graphics Tools installed). No device removal. - With this change, the lib test binary run directly: - the test alone, 20 runs: 20 passed; - the full lib suite at `--test-threads=16` (the default here), 22 runs: 22 × 809 passed, 0 failed. - On main `c160d86`, the failure is rare on this machine: 1 of 3 earlier `cargo test --workspace` runs at default threads (#1487). In today's runs: 0 of 20 with the test alone, 0 of 10 full-lib runs at 16 threads, and 0 of 30 full-lib runs at 32 threads. So the zero above shows that the change breaks nothing, but it does not prove the flake is gone. The cause above is from reading the code. **Regression run** - Run and posted by Toons29 in [this comment](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1671) (not on our machine): `scripts/smoke.ps1` on the retail title, 60 s, release build, `XCL_NETWORK=0`, AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0. Blocks copied unchanged: `main` on `4178e888`, this PR on its head commit with no uncommitted changes. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 85a743fdb3861bd15b1f3bd32a30f2f0c0363dc9 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1632 (PresentX 1632) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` - Against the limits in CONTRIBUTING.md: 1632 against 1618 frames (101 %), 14812 against 14831 MB peak commit, 0 crashes, 0 device removals. The diff is inside `#[cfg(test)] mod tests` only, so this run only shows that the build is unaffected; it does not reach the changed test. **Not tested** - Retail title / `scripts/smoke.ps1` on our machine (no game files); the regression run above is Toons29's. NVIDIA and Intel (but see the RTX 3060 Ti `cargo test -p xcl --lib` result from DavidM1911 in the comments). **AI use** - Claude Code (Claude Opus 5.5): code, tests and description; reviewed by Diskuss. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
a_page_whose_move_fails_stays_mapped_where_it_was reserved and released an
address to have one nothing is reserved at. In a parallel run another test can
reserve that address again before move_away runs; the commit then succeeds,
the page's 64 KiB are copied over that test's memory, and the assert fails.
The destination is now a kernel-space address, where a commit always fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:07 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 21:26 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 21:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1671#issuecomment-7144936168) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:35 UTC · original

Regression run of 85a743fd on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 85a743fdb3861bd15b1f3bd32a30f2f0c0363dc9
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1632 (PresentX 1632)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 03:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/1671#issuecomment-7152051177) Regression run of `85a743fd` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 85a743fdb3861bd15b1f3bd32a30f2f0c0363dc9 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1632 (PresentX 1632) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1671/head:github-bot/gh-1671'
git switch 'github-bot/gh-1671'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1671'
git switch 'github-bot/gh-1671'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1671'
git switch 'github-bot/gh-1671'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1671'
git switch 'main'
git merge --squash 'github-bot/gh-1671'
git switch 'main'
git merge --ff-only 'github-bot/gh-1671'
git switch 'main'
git merge 'github-bot/gh-1671'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.