kernelx: keep lazy pages on failed MEM_COMMIT (#467) #487
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!487
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-487"
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?
@Grimkaaah on GitHub · 2026-11-24 00:58 UTC · original
Grimkaaah:fix/467-lazy-commit-keep-on-fail→main· +81 −10 · 3 files · 1 commits · openSummary
LAZYonly afterVirtualAlloc(MEM_COMMIT)succeeds, so a commitment-limit failure can be retried instead of becoming a bare0xc0000005on still-reserved memory.count, last page,GetLastError) and appendfail_summary()to the AV crash line ineh.rs.lazy::ensurenow returnsbool; DirectStoragewritable()fails closed when a destination page cannot be committed.Fixes #467
Test plan
cargo test -p xcl --lib hle::kernelx::lazy::(3 passed, including failed-commit keeps page lazy)github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@brothernog on GitHub · 2026-11-24 01:44 UTC · original
Tested
bf21bcbon an RTX 3050 (driver 610.88), Windows 11 Home 26300, Rust 1.100.0, debug. This adds one thing to the comparison on #467, about thedstorage.rshunk: it does change behaviour, and it can refuse a healthy destination.ensuretakes the lazy pages under the read lock (lazy.rs:129), drops it, then callscommitfor each.commitreturnsfalsewhen the page is no longer inLAZY(lazy.rs:67), which is also the case when another thread committed it in between: a secondensure, or the title touching the page and the vectored handler committing it.ensurethen reports a failure, andwritable(dstorage.rs:728) fails a request whose pages are all committed and writable.I added a temporary test (removed afterwards): 256 lazy pages, two threads behind a barrier call
ensureover the same range. In 5 of 5 runs at least one call returnedfalse(4 runs[false, false], 1 run[true, false]), and every page was committed afterwards.Dropping the hunk keeps the fix:
writablealready checks every page withVirtualQueryafterensure, so a page that stayed reserved fails there. If you want the bool kept,commitcould tell "not lazy any more" apart from "the commit failed", andensurecould returnfalseonly for the second case.This review was AI-assisted.
@MesshM on GitHub · 2026-11-24 05:16 UTC · original
Test run of
bf21bcba64680fb85a01e4802a86971af03c4e36on AMD RDNA4. I merged it onto currentmain6025201locally (clean merge).Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 705 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 664 passed, 0 failed, 21 ignoredSKIPPED; thelazytests pass, the failed-commit one included.Review: Removing a lazy page from
LAZYonly afterMEM_COMMITsucceeds is right. Overlap with #512 (open), whose title is about the e2e test output but which also changeskernelx/lazy.rsto keep the page on a failed commit; the two will conflict there, and this PR is the one that is about #467.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@asd3670576 on GitHub · 2026-11-24 10:25 UTC · original
Built and tested the PR head on a Windows 10 machine that has no Shader Model 6.6 and only a GNU toolchain. Every count below is pasted from the run, not written by hand.
Machine
x86_64-pc-windows-gnu(no MSVC, no Windows SDK:cargo buildhere needs MinGW-w64 on PATH or it dies witherror calling dlltool 'dlltool.exe': program not found), Ryzen 9 5950X (32 logical CPUs), 64 GB RAM.H:\leonida\dxc\bin\x64(XCL_DXC_DIR). Agility 1.620.2 atH:\leonida\agility\build\native\bin\x64(XCL_D3D12_DIR) but it cannot load on this OS build (noID3D12SDKConfiguration1before KB5029331), so the inbox runtime caps at Shader Model 6.5 and XCL's GPU recompiler path is unavailable here.xcl-smokeblock from this machine.Apply / build
git fetch https://github.com/ivall/xcl pull/487/head:pr487→bf21bcba64680fb85a01e4802a86971af03c4e36, checked out as-is: no rebase, no conflict resolution,git status --porcelainempty before the build and after it. The API reportsmergeable: true,mergeable_state: unstableagainst currentmain.cargo build --release --workspace→ exit code 0:Tests
cargo test --release -p xcl --lib -- kernelx::lazy, three runs on the default thread count:cargo test --release -p xcl --lib -- gpu::recomp::dxc:cargo test --release -p xcl --lib -- kernelx::lazy gpu::recomp::dxc(both modules in one process, default threads):cargo test --release --workspace --no-fail-fast -- --test-threads=4→ exit code 0. 16test result:lines (one per test binary plus the doc-test run); the xcl lib is:all 16 are
ok; summed over them: 677 passed; 0 failed; 41 ignored. Skips, reported rather than counted as coverage: 86SKIPPEDlines, 84: no GPUand 2: no wave64, for exampleForcing the requirement shows the SM 6.5 cap directly (
XCL_REQUIRE_GPU=mesh cargo test --release -p xcl --lib -- --exact gpu::recomp::tests::gpu_bvh_intersect_ray):On the
dstorage.rshunk. The code in this head agrees with @brothernog's reading:commitreturnsfalseboth when the page is no longer inLAZY(another thread committed it) and whenVirtualAllocfails, andensuremaps either one tofalse. The pre-existingthreads_first_touching_one_lazy_page_together_all_go_ondrives the pages through the vectored handler rather than throughensureand asserts nothing about a return value, so it cannot catch that case; the new test covers the failed-commit path only. I did not measure the race itself here.What this machine can and cannot verify. It can verify that the head builds in release with the GNU toolchain, that the three
kernelx::lazytests are stable here (3/3, and 17/17 with the dxc tests in the same process), and that nothing else in the workspace regresses. It cannot verify the case the fix is about: with 64 GB of RAM and a 153 GB commit limit (125 GB of it free) nothing here reachesERROR_COMMITMENT_LIMIT, socommit's failure branch only runs because the test injects a failing allocator. And because the adapter caps at SM 6.5, no GPU test executed at all — the 84 skips are the whole GPU surface, so this run says nothing about the recompiler paths.AI use: an agent (DeepSeek Harness, "auto" route - I do not know the underlying model) built the head, ran the tests and pasted the output.
@throny on GitHub · 2026-11-24 21:15 UTC · original
Two contributors checked independently and found that #488 solves the same problem (for #467) in a different way: #1607, group D13. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@Toons29 on GitHub · 2026-11-25 02:56 UTC · original
Regression run of
bf21bcbaon the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 90 % 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.@DavidM1911 on GitHub · 2026-11-25 14:05 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@mdberkey on GitHub · 2026-11-24 00:59 UTC · original · reviewed
t
@shdann on GitHub · 2026-11-24 01:01 UTC · original · reviewed
lazy::ensurecan reject a writable destination when two callers snapshot the same lazy page. The first caller commits it and removes it fromLAZY. The second then getsfalsefromcommitbecause the entry is gone.dstorage::writabletreats that as a commit failure and rejects the request. Please distinguish an entry that is already gone from a failedVirtualAlloc, and let the existing writability check handle the former. A two-caller test should check that both requests succeed when the page was committed successfully. Static review with OpenAI Codex (GPT-6).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.