kernelx: preserve explicitly committed physical pages on unmap #934

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

@⁠Babyhamsta on GitHub · 2026-11-24 08:43 UTC · original
Babyhamsta:kernelx/physical-unmap-content → main · +159 −18 · 3 files · 1 commits · open

A Windows VirtualAlloc commit can populate a lazy physical-page mapping without invoking XCL's lazy fault handler. Unmapping then discards the bytes as if the page were untouched.

What is in it

  • Preserve committed spans on unmap and leave reserved spans zero. If a committed span cannot be read, keep the mapping so the caller can restore access and retry. Added regressions for a full commit and disjoint 4 KiB commits.

Tested

  • Windows 11 build 26300, RTX 4070 driver 621.35, Intel i7-13700K, rustc 1.94.1. Debug tests and release smokes.
  • cargo test --workspace --offline --locked -- --test-threads=4 reported 718 passed, 0 failed, 41 ignored. Two of the reported passes printed SKIPPED for no wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.
  • Both preservation regressions failed with the runtime from main and passed on this head. The focused kernelx suite reported 27 passed, 0 failed, 1 ignored.

Regression run
Both clean builds ran the upstream smoke script offline for 60 seconds with fresh private data and separate cold DXIL caches. An earlier pair with copied saves hit the same startup breakpoint on both builds, so the fresh-profile pair below is the gate.

Main

xcl-smoke v1
commit: 09940bb87fa11bc394fd9e5de570c2b7cfd16323
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 459 (PresentX 459)
presents per 2 s (last 3): 11 11 14
device removals: 0
crashes: 0
peak commit: 15345 MB

This PR

xcl-smoke v1
commit: 54ba01423ba0c19a24046c370841d31c0635b4f4
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 546 (PresentX 546)
presents per 2 s (last 3): 27 24 25
device removals: 0
crashes: 0
peak commit: 15339 MB

Not tested

  • The retail smoke does not show whether the title exercised the specific external-commit path. AMD and Intel GPU runs were not performed.

AI use

  • Codex, GPT-6 (exact deployment identifier unavailable), implemented the fix and regression tests and assembled the report from the retained test and smoke outputs.
**@⁠Babyhamsta** on GitHub · 2026-11-24 08:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/934) `Babyhamsta:kernelx/physical-unmap-content` → `main` · +159 −18 · 3 files · 1 commits · open A Windows `VirtualAlloc` commit can populate a lazy physical-page mapping without invoking XCL's lazy fault handler. Unmapping then discards the bytes as if the page were untouched. **What is in it** - Preserve committed spans on unmap and leave reserved spans zero. If a committed span cannot be read, keep the mapping so the caller can restore access and retry. Added regressions for a full commit and disjoint 4 KiB commits. **Tested** - Windows 11 build 26300, RTX 4070 driver 621.35, Intel i7-13700K, rustc 1.94.1. Debug tests and release smokes. - `cargo test --workspace --offline --locked -- --test-threads=4` reported 718 passed, 0 failed, 41 ignored. Two of the reported passes printed `SKIPPED` for no wave64: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`. - Both preservation regressions failed with the runtime from main and passed on this head. The focused kernelx suite reported 27 passed, 0 failed, 1 ignored. **Regression run** Both clean builds ran the upstream smoke script offline for 60 seconds with fresh private data and separate cold DXIL caches. An earlier pair with copied saves hit the same startup breakpoint on both builds, so the fresh-profile pair below is the gate. Main ``` xcl-smoke v1 commit: 09940bb87fa11bc394fd9e5de570c2b7cfd16323 gpu: NVIDIA GeForce RTX 4070 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 459 (PresentX 459) presents per 2 s (last 3): 11 11 14 device removals: 0 crashes: 0 peak commit: 15345 MB ``` This PR ``` xcl-smoke v1 commit: 54ba01423ba0c19a24046c370841d31c0635b4f4 gpu: NVIDIA GeForce RTX 4070 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 546 (PresentX 546) presents per 2 s (last 3): 27 24 25 device removals: 0 crashes: 0 peak commit: 15339 MB ``` **Not tested** - The retail smoke does not show whether the title exercised the specific external-commit path. AMD and Intel GPU runs were not performed. **AI use** - Codex, GPT-6 (exact deployment identifier unavailable), implemented the fix and regression tests and assembled the report from the retained test and smoke outputs.
VirtualAlloc can populate a lazy mapping without entering the fault handler. Save the committed spans before releasing the mapping and keep reserved spans zero. Keep unreadable mappings intact so the caller can restore access and retry.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:27 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 08:56 UTC · original

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
715 passed; 0 failed; 41 ignored   (exit 0)

Two more passing tests than main: preserving explicitly committed physical pages on unmap is exercised and green.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 08:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/934#issuecomment-7126764541) Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean `main@beaa245` (713 passed, 0 failed, 41 ignored on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 715 passed; 0 failed; 41 ignored (exit 0) ``` Two more passing tests than main: preserving explicitly committed physical pages on unmap is exercised and green. Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 10:37 UTC · original

Heads-up: this branch no longer merges cleanly.

Rebuild today: pull/934/head onto current main hits a merge conflict (kernelx page-table code; main moved through the sparse/mapping work since the branch was cut). CI is Windows-only and stopped at the conflict, so nothing else covers it here. Untested until rebased; I can run it on RDNA3/Wine after that.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 10:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/934#issuecomment-7129032572) Heads-up: this branch no longer merges cleanly. Rebuild today: `pull/934/head` onto current main hits a merge conflict (kernelx page-table code; main moved through the sparse/mapping work since the branch was cut). CI is Windows-only and stopped at the conflict, so nothing else covers it here. Untested until rebased; I can run it on RDNA3/Wine after that. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 09:17 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main (crates/xcl/src/hle/kernelx.rs) — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 09:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/934#issuecomment-7158128986) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** (`crates/xcl/src/hle/kernelx.rs`) — needs a rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/kernelx.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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