DirectStorage: read a page list naming page 0 again before failing its request #1726

Manually merged
github merged 1 commit from gh-pr/1726/head into gh-pr/1726/base 2026-11-26 04:42:53 +00:00
Owner

@⁠npanu420 on GitHub · 2026-11-24 21:24 UTC · original
npanu420:dstorage/late-page-lists → main · +84 −3 · 1 files · 1 commits · merged 2026-11-25 00:18 UTC

What

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 at 0x10_0000), xmem::write_physical returns false and the request fails with E_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):

Build Failed page-destination requests
without the re-read 883 in one run, in bursts of up to 687 in a single second
copying the list at enqueue instead (rejected) 15,264, and the load never finished: the lists are still empty at enqueue
with this change 0. One list was written late and recovered

These were taken on a branch of fxceless/victory-gta6, whose into_destination is the same code as main here apart from a warning line. This PR is the change rebuilt on main (ffe310e).

Changes

  • into_destination: if write_physical fails 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 now logs a warning instead of failing silently.
  • Test 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

cargo test -p victory-hle --lib dstorage              # 14 passed
cargo clippy -p victory-hle --all-targets --locked -- -D warnings
cargo xtask policy

rustfmt --check reports 9 differences in dstorage.rs, all already on main. This change adds none.

No game data is used or committed. AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠npanu420** on GitHub · 2026-11-24 21:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/1726) `npanu420:dstorage/late-page-lists` → `main` · +84 −3 · 1 files · 1 commits · merged 2026-11-25 00:18 UTC ## What 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 at `0x10_0000`), `xmem::write_physical` returns false and the request fails with `E_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): | Build | Failed page-destination requests | |---|---| | without the re-read | 883 in one run, in bursts of up to 687 in a single second | | copying the list at enqueue instead (rejected) | 15,264, and the load never finished: the lists are still empty at enqueue | | with this change | **0**. One list was written late and recovered | These were taken on a branch of `fxceless/victory-gta6`, whose `into_destination` is the same code as `main` here apart from a warning line. This PR is the change rebuilt on `main` (ffe310e). ## Changes - `into_destination`: if `write_physical` fails 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 now logs a warning instead of failing silently. - Test `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 ```powershell cargo test -p victory-hle --lib dstorage # 14 passed cargo clippy -p victory-hle --all-targets --locked -- -D warnings cargo xtask policy ``` `rustfmt --check` reports 9 differences in `dstorage.rs`, all already on `main`. This change adds none. No game data is used or committed. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title writes a request's page list after enqueueing it, and a queue
half full is submitted on its own, so a read can start before the list is
filled. It then names page 0 (no page: numbers start at 0x10_0000), the
write to physical pages fails, and the request fails silently: the title
never reads a request's result, so the model or texture stays unwritten.
The list is now read again for up to 8 ms before the request fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:53 +00:00
github manually merged commit d09f3aa86c into gh-pr/1726/base 2026-11-26 04:42:53 +00:00
Author
Owner

@⁠acetonahard-code on GitHub · 2026-11-24 22:08 UTC · original

Tested on Windows 11 with the repo toolchain, merged into current main (70564ae):

cargo test -p victory-hle passed failed ignored
main 99 0 0
main + this PR 100 0 0
  • The new test passes.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

**@⁠acetonahard-code** on GitHub · 2026-11-24 22:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1726#issuecomment-7145858629) Tested on Windows 11 with the repo toolchain, merged into current `main` (70564ae): | `cargo test -p victory-hle` | passed | failed | ignored | |---|---|---|---| | `main` | 99 | 0 | 0 | | `main` + this PR | 100 | 0 | 0 | - The new test passes. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Author
Owner

@⁠kais7654 on GitHub · 2026-11-24 22:50 UTC · original

Reviewed and verified: the late-fill test passes and all 14 dstorage
tests stay green on Windows — a list naming page 0 written while the
request runs is caught and applied once the title fills it. One note:
each late request sleeps on its worker thread for up to 8 ms before
failing; fine at these rates, worth revisiting if a frame ever waits
on a batch of them.

**@⁠kais7654** on GitHub · 2026-11-24 22:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/1726#issuecomment-7146703980) Reviewed and verified: the late-fill test passes and all 14 dstorage tests stay green on Windows — a list naming page 0 written while the request runs is caught and applied once the title fills it. One note: each late request sleeps on its worker thread for up to 8 ms before failing; fine at these rates, worth revisiting if a frame ever waits on a batch of them.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1726
No description provided.