DirectStorage: a destination page array entry that is 0 at enqueue is read at the request's turn #289
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!289
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/289/head"
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?
@theaustinayers on GitHub · 2026-11-23 22:28 UTC · original
theaustinayers:dstorage-late-page-array→main· +87 −0 · 1 files · 1 commits · merged 2026-11-23 22:54 UTCA title that keeps its DirectStorage destination page arrays in its own tables, and fills an entry after
EnqueueRequest, had those requests refused withE_ACCESS_VIOLATION(0x89240009): the array is snapshotted at enqueue, the snapshot held page number 0, andwrite_physical_pagesrefuses a page that is not live. With this change an entry that is 0 in the snapshot is read again when the request runs. No issue is open for it; I searched open and closed PRs for "page array", "DestinationPageArray" and "physical pages DirectStorage" and found none covering it.Reproduced on main (
9ab7d76): a retail title, launched withscripts/smoke.ps1 -Game <folder>(XCL_NETWORK=0, 60 s, no input), reaches its first screen (an account prompt) and starts streaming in the background. In that run the activity lines add up to 28,298 DirectStorage requests, 537 failed, and the log hasDirectStorage: a request failed (0x89240009): 65536 bytes from …for texture pool files. With extra logging on a local build, each refused request hadoptions 0x200001(zlib, destination is physical pages), a one-entry page array holding0at enqueue, and the same address holding a live page number (for example0x80f50) by the time the request ran.What is in it
crates/xcl/src/hle/dstorage.rs,execute: when the enqueue-time snapshot of the destination page array contains a 0, those entries are read again from the title's array; entries that had a page keep the snapshot's value, so an array passed on the stack and overwritten after enqueue behaves as before (the existingphysical_page_destinations_and_sourcestest still covers that).a_destination_page_filled_in_after_enqueue: an array whose second entry is 0 at enqueue and gets its page beforeSubmit; the data must land across both pages, and an array still 0 at the request's turn must still fail withE_ACCESS_VIOLATION. It fails without the change (S_OKexpected, 0x89240009 returned) and passes with it.Tested
D3D12.X: backend 'real' – NVIDIA GeForce RTX 5090).cargo build --workspacethencargo test --workspace -- --test-threads=4ond0b6079(debug): 651 passed, 0 failed, 40 ignored (lib 612 / 0 / 20).gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).d0b6079: 24,067 DirectStorage requests, 157 failed, no 0x89240009 line in the log (main: 28,298 / 537). I did not break the remaining 157 down by code in this run. On a longer run of a local build with the same change and a counter (170 s into streaming): 16,384 requests found their page at their turn, 2,227 still had 0 and were refused.Regression run
The
gpu:line is the firstWin32_VideoControlleron this PC (the CPU's integrated graphics); XCL ran on the RTX 5090 in both runs. The blocks are as the script wrote them.main:
this PR's head:
Not tested
SourceIsPhysicalPages) with a 0 entry: not changed.AI use
@mastrr9 on GitHub · 2026-11-23 22:52 UTC · original
Independent static code audit of
d0b6079c4(code inspection only —cargo testnot run on macOS; no game files):Summary: Looks clean and well-targeted
0in the enqueue snapshot (preserving stack-allocated arrays that already held live page numbers atEnqueueRequest), checksreadable(r.destination as usize, std::mem::size_of_val(pages))before reading, and leaves entries still0rejected bywrite_physical_pages.Minor edge-case notes
dstorage.rs:835):(r.destination as *const usize).add(k).read_unaligned()runs on the worker thread; if a title fills a slot concurrently afterSubmit()without prior synchronization, an atomicAcquireload (when pointer-aligned) avoids a Rust data race.0: If a caller passes a stack array containing a0entry and returns beforeexecuteruns,readable(r.destination, ...)can still be true on the live thread stack and read unrelated stack words (low risk sincewrite_physical_pagesstill rejects non-live page numbers, just worth keeping in mind).(AI-assisted)
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175