Repository navigation
DirectStorage: a deferred page-array entry is reread without faulting (#476) - #509
Conversation
…xcl-dev#476) A destination page array entry that is 0 at EnqueueRequest is read again at the request's turn (xcl-dev#289). That read checked `readable()` and then dereferenced the title's memory: an array the title unmapped between the two faulted in the xcl-dstorage worker and ended the process. It now reads with `read_own` (ReadProcessMemory), as the snapshot at enqueue already does: the request fails with E_ACCESS_VIOLATION instead. An array the title frees and reuses before the request's turn cannot be told from a late fill; the title keeps it until the request is done, as the comment now says. The test runs 20000 requests with a deferred entry while another thread decommits and recommits the array's page: before, the test process ended with 0xc0000005 (5 of 5 runs); after, it passes (10 of 10). Fixes xcl-dev#476 Assisted-by: Claude Code (Claude Opus 5.5)
Port xcl-dev/xcl#509 from 3724b07, including the concurrent decommit regression. Keep this integration's single-stage BCPack support.
|
Tested
A sibling with the same check-then-read shape is in the same function. A memory source is checked with This review was AI-assisted. |
|
@brothernog thanks for the independent run, and for the memory-source copy: you were right. Same shape, same fault: the new test on Written with Claude Code (Claude Opus 5.5). |
|
Test run of Tested
Review: Rereading the deferred entries with Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
A memory-source request's source was checked with `readable()` and then copied with `copy_nonoverlapping` on the xcl-dstorage worker, at the request's turn: a source the title unmapped between the two faulted in the worker and ended the process (the source side of xcl-dev#476, found by brothernog in the review of xcl-dev#509). It is now copied with `read_own` (ReadProcessMemory), as the page arrays are: the request fails with E_ACCESS_VIOLATION instead. The test runs 20000 memory-source requests while another thread decommits and recommits the source page: before, the test process ended with 0xc0000005 (5 of 5 runs); after, it passes (10 of 10). Assisted-by: Claude Code (Claude Opus 5.5)
|
Diff check on
Next step to unblock merge: Please rebase onto current |
…ility - kernelx: keep plain XMemVirtualAlloc/physical fallbacks below the 40-bit VA ceiling via VirtualAlloc2 when available; stop large AllocateTitlePhysicalPages pools from stealing pre-committed coherent UMA; skip committing lazy/unmapped pages on read_physical_pages while ensuring lazy pages before writes; unmark freed lazy pages in FreeTitlePhysicalPages. (XMemIsToolsMemAvailable is already on main via xcl-dev#563.) - dstorage: refresh zero or stale (freed) physical page-table entries via read_own (xcl-dev#476/xcl-dev#509 safe) on write/read retry; extend the parallel decompression pool to handle physical-page destinations and supported BCPack requests. - gameinput & kbm: skip disconnected-pad XInput rumble stalls and deduplicate unchanged motor speeds; implement bounded reading history for GetNextReading / GetPreviousReading; extend XCL_PRESS_AT with triggers, sticks, LS/RS, and optional durations; add Z/C holdable bumper keys, require mouse capture and non-sizing for mouse buttons, and guard KBM mouse velocity against sub-0.5 ms zero-delta poll decay.
Conflicts: - the translator's version is one of its own (its output differs from main's: globallycoherent windows only where a program needs them, xcl-dev#1850); - compute and graphics driver blobs reach the disk cache also when the store in memory is full (main's read_pso_cached_blob and graphics blobs, our return of the blob); - sparse: our copies back with main's lock_state and wait notes; - title textures: our uploads on the title's queue in main's batches (256 textures, 32 MiB); - DirectStorage: a page list is read again at execution (xcl-dev#1405) through main's read_own (xcl-dev#509); - list_x / bind: our diagnostics and the ExecuteIndirect guard kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ility - kernelx: keep plain XMemVirtualAlloc and alloc_physical_home plain fallbacks below the 40-bit VA ceiling via VirtualAlloc2 when available; skip committing lazy/unmapped pages on read_physical_pages while ensuring lazy pages before writes; unmark freed lazy pages in FreeTitlePhysicalPages. (Coherent fallback skip on sparse layouts is already on main via xcl-dev#2157; XMemIsToolsMemAvailable via xcl-dev#563.) - dstorage: refresh zero or stale (freed) physical page-table entries via read_own (xcl-dev#476/xcl-dev#509 safe) on write/read retry; extend the parallel decompression pool to handle physical-page destinations and supported BCPack requests. - gameinput & kbm: skip disconnected-pad XInput rumble stalls and deduplicate unchanged motor speeds; implement bounded reading history for GetNextReading / GetPreviousReading; extend XCL_PRESS_AT with triggers, sticks, LS/RS, and optional durations; add Z/C holdable bumper keys, require mouse capture and non-sizing for mouse buttons, and guard KBM mouse velocity against sub-0.5 ms zero-delta poll decay.
A destination page-array entry that is 0 at EnqueueRequest is read again at the request's turn (#289). That read checked
readable()and then dereferenced the title's memory. If the title unmapped the array between the two, the read faulted in thexcl-dstorageworker and ended the process. It now reads withread_own(ReadProcessMemory), as the enqueue-time snapshot already does, so the request fails withE_ACCESS_VIOLATIONinstead. Fixes #476.An array that is freed and reused before the request's turn cannot be told from a late fill. The title keeps it until the request is done; the comment now says so.
What is in it
crates/xcl/src/hle/dstorage.rs,execute: the deferred entries are read withread_own; if that read fails, the request keeps its 0 entries and fails as beforecrates/xcl/src/hle/dstorage.rs, tests:a_deferred_page_array_unmapped_under_the_worker_fails_the_requestruns 20000 requests with a deferred entry while another thread decommits and recommits the array's pageTested
main2997c9a, without the fix (5 runs,--exact): 5 ×0xc0000005 STATUS_ACCESS_VIOLATION; with the fix: 10 of 10 passed;hle::dstoragetests: 14 passedcargo test --workspace -- --test-threads=4on 3724b07: 677 passed, 0 failed, 41 ignored (main 2997c9a on the same machine: 676 passed, 0 failed, 41 ignored)gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareRegression run
main:
PR:
Not tested
AI use