Repository navigation
Lazy physical pages: a thread that loses the race to commit a page retries - #244
Conversation
…tries Two threads that first touch the same lazy page together both fault. The first commits the page and removes it from the lazy set; the second then finds it gone and returned EXCEPTION_CONTINUE_SEARCH, so its access ended the process as an unhandled access violation although the page was committed by then. The handler now lets the faulting instruction run again when the page is committed and its protection allows the access (read or write; not execute or guard pages). A test has 8 threads first-touch 256 lazy pages at the same moment: before, the test process ends with 0xc0000005 (3 of 3 runs); after, it passes (3 of 3).
|
Confirming on GTA VI (retail), RX 7800 XT, |
|
I compared this with #250, which fixes the same race. Both fix it. They differ in one case, a genuine fault, and this PR handles that case correctly. Findings
Tested
Not tested
🤖 Claude Opus 5.5 |
|
Test report on NVIDIA with this PR's head, on top of current main. Setup: RTX 5070 Ti (16 GB), driver 616.92, Ryzen 7 7700X / 32 GB RAM, Windows 11 26300, release builds. Retail GTA VI 1.0.2.1 with
Not tested: AMD, the PR's own test ( AI-assisted: Claude Code (Claude Opus 5.5) ran the builds and the game and wrote this report. |
Handle 16-byte constant-buffer records, upload intro textures from their CPU view, and decode BC1 BCPack streams. Share bounded texture pages, batch upload staging, and tolerate pages decommitted during streaming reads. Includes work from ivall/xcl ivall#208, ivall#244, ivall#252, ivall#254, ivall#269 and ivall#283. DirectStorage late destination pages are already in the base. Assisted-by: OpenAI Codex (gpt-6.2-sol)
The fork, rebuilt on current upstream main with only what upstream does not have: the launcher's folder picker, click-to-capture mouse handling with F8 and Page Up / Page Down, a heap per DXC compile thread, the limit on waits for pipelines still being built, the installer, build.ps1, BUILDING.md, the release workflow and the README. Everything else the fork carried is in upstream now (ivall#195 in parts, ivall#211, ivall#244, ivall#252, ivall#283, ivall#289) or was a diagnostic. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Problem
kernelx::lazy(38b05b7) commits a lazy physical page from a vectored handler on first touch. When two threads fault on the same lazy page at the same time:LAZYand commits it;containsis false, orcommit'sremovereturns false) and returnsEXCEPTION_CONTINUE_SEARCH.So the second access ends the process as an unhandled access violation, although the page is committed by then.
Seen with a retail title on main while it loads its world: two threads crash within 1 ms at the same instruction, writing two addresses in one 64 KiB page:
Change
lazy.rsonly. The handler also lets the faulting instruction run again when the faulting address is now committed and its protection allows the access: reads and writes only, not execute or guard pages. The retry then succeeds. A fault whose access is still not allowed goes on to the next handler as before.Testing
threads_first_touching_one_lazy_page_together_all_go_on: 8 threads first-touch each of 256 lazy pages at the same moment through a barrier, and every write is checked afterwards.0xc0000005(3 of 3 runs).cargo test --release -p xcl --lib kernelx::: 19 passed.XCL_RUN_SECONDS.Not related to #236, whose race is between upload scanning and decommit in
sparse.rs.