DirectStorage: read a page list naming page 0 again before failing its request #97
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!97
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/97/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?
@npanu420 on GitHub · 2026-11-24 21:28 UTC · original
npanu420:dstorage/late-page-lists→main· +72 −2 · 1 files · 1 commits · closed without mergingWhat
A DirectStorage request into physical pages (
PAGE_DESTINATION) whose page list names page 0 is read again for up to 8 ms before the request fails.Why
The title writes a request's page list after enqueueing it, and
queue()submits a queue on its own once half of it is enqueued. A worker can then start the read before the list is filled: it names page 0, which is no page (numbers start at0x10_0000),xmem::write_physicalreturns false and the request fails withE_INVALIDARG. Nothing logs it, and the title never reads a request's result (it only polls for completion), so the model or texture is silently left unwritten.Two measurements on the same machine (RTX 3070, Windows 11, Series X profile, a world load into the first story pack):
Measured on this fork (main at
4e17478plus this change). The same change is proposed upstream as Marvisak/VIctory#1726.Changes
into_destination: ifwrite_physicalfails and the list holds a 0, the title's list is read again every 1 ms, 8 times. Recovered writes are counted and logged at powers of two (written late). A request that still fails keeps the existing warning, and lists that stay at 0 are counted (still names page 0 after 8 ms).a_page_list_filled_after_its_request_starts: the list is filled 2 ms after the request is submitted, and the data must arrive. It fails without the change (checked with the retries set to 0) and passes with it, repeatedly.Verification
No game data is used or committed. AI-assisted (Claude Code).
🤖 Generated with Claude Code
@deepdev237 on GitHub · 2026-11-25 04:03 UTC · original · edited 2026-11-25 05:11 UTC
Full test environment
x86_64-pc-windows-msvccargo build --profile diag -p victory --features diagnostics(diag= release + debug info)main310c6eb6c16822ab95076aad61fce19bba86bb98levels.rpf,audio.rpf,pack/story000/story000.rpf,navmeshes.rpfand sixdata/ttdb/*.ttpf), so failures that depend on those bytes are not emulator bugs.Merge note against current
main(310c6eb):into_destinationindstorage.rsalready retries failed physical-page writes (VICTORY_DSTORAGE_RETRIES, default 12, backoff 2→128 ms, about 1.5 s in all). Each retry callsxmem::write_physical(pages, ...)again, andpagesthere isslice::from_raw_parts(request.destination ...), a live view of the title's page list, not a copy. So a list that names page 0 because the title fills it after enqueueing is read again on every retry. As far as I can tell, that covers this PR's case with a longer window (8 ms here against about 1.5 s there).The conflict is the whole retry block, so I left this PR out of my integration build instead of stacking both loops. The part
maindoes not have is thelate/still_zerocounting, which would show whether page-0 lists still happen. That could go intomain's retry loop as a log on its own, if wanted.Related observation from the same runs (RX 9060 XT,
310c6ebplus #571, #552, #621, #575): the DirectStorage failures I still see are not page writes at all. They are decompression failures,request failed: zlib options=0x200001 ... hr=0x8007000dandBCPack: the stream ends early or is corrupt options=0x200002 ... hr=0x8007000d, at source offsets that fall inside zero-filled regions of my copy of the game files. So in my case those requests are damaged input data, not something the emulator can fix.Exact state and data
7e22f187dd7ec6f632a07857b1fe3718ec350638. The merge onto the integration branch conflicts incrates/victory-hle/src/modules/dstorage.rs(the whole retry block ofinto_destination), so it was aborted and left out.424E48C9347896B0A557BA07F7155C363E18790E0C7385EF9F1E7CAF3BA1BA19(integration of310c6eb+ about 120 PRs, including #571, #552, #621 and #575), switchesVICTORY_NO_WATCHDOG=1 VICTORY_TEXTURE_NO_WAIT=1 VICTORY_BAKE_TEXTURES_MS=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_RAGE_DEBUGINFO=30 VICTORY_SKIP_PIPELINES=c1eee35dbc50a9ef,f16876929fa64f9f,39f0e9aeb156a61c, 355.6 s from boot to the first gameplay scene.0x200001(zlib, page destination),0x200002(BCPack, page destination) and two0x1(zlib), allhr=0x8007000d. All 85 have their source offset inside a zero-filled region of one of the damaged archives (83 in TTDB texture archives, 2 at offsets matchingnavmeshes.rpf's hole). The log line has no file name (name=""), so the archive is inferred from the offset only.dstorage-failed-requests-run.txtin https://gist.github.com/deepdev237/785e05b02d0dcece7aac1303f7fe4ba8retries used up) were logged in that run.@npanu420 on GitHub · 2026-11-25 05:42 UTC · original
Closing: as noted above, main's
VICTORY_DSTORAGE_RETRIESloop re-reads the live page list on every retry, which covers the late-filled list case with a longer window. Thanks for testing it. (AI-assisted, Claude Code; no game data.)Pull request closed