DirectStorage: wait up to 250 ms for a page list the title fills late #2338

Closed
github-bot wants to merge 1 commit from gh-pr/2338/head into gh-pr/2338/base
Owner

@⁠JurajSimicevic on GitHub · 2026-11-25 11:01 UTC · original
JurajSimicevic:dstorage/late-page-lists → main · +26 −6 · 1 files · 1 commits · closed without merging

Problem

A DirectStorage request into physical pages (PAGE_DESTINATION) whose page list still names page 0 is read again for 8 ms (#1726) and then fails with E_INVALIDARG. The title never looks at a request's result, so each failure is a model or texture left unwritten. #2181 sees untextured geometry after such a burst.

On a fast host the data is read and inflated before the title has filled the list, and 8 ms is not always enough. On this host (Windows 11, RTX 5080, NVMe), three world loads on main 940d32f, with the typed-UAV check of #1775/#1763 to boot, logged "a destination's physical pages could not be written; its request fails" 391, 45 and 24 times, each time in one burst while the world loads.

What the failed requests had in common (local diagnostics, not in this PR)

  • In all 40 failures logged in detail, the page list still named page 0 when the request failed, in full or in part. The other entries were pages the title holds. No page was freed, out of range or failing to map.
  • 24 lists were watched after their request had failed. Every one was filled 3 to 6.5 ms after the 8 ms ran out, and all the pages were ones the title holds. The data had been read and inflated; only the wait was too short.

Change

  • The list is read again for up to 250 ms (LATE_LIST_WAIT) instead of 8 tries of 1 ms. A list that still names page 0 after that fails as before.
  • The "written late" log line also says how long the read waited (waited_ms).
  • Tests: #1726's test is now a helper with two cases, the list filled 2 ms and 40 ms after the request starts. The 40 ms case fails with the 8 ms wait (E_INVALIDARG, -2147024809) and passes with this change.

crates/victory-hle/src/modules/dstorage.rs only, +26 −6.

Tested

  • cargo test -p victory-hle --locked: 144 passed.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings, with and without --all-features: clean. No new rustfmt hunks.
  • In the title, with this change (two runs, RTX 5080, diag build):
run requests failed lists written late waited
1 0 none logged –
2 0 16 to 31 (the counter logs at powers of two) 5 to 6 ms

The limit, said plainly: in both runs the race either did not happen or ended within 8 ms, which the old wait also covers. So the in-title runs show that this changes nothing for the worse. The case it fixes, lists later than 8 ms, rests on the diagnostics above and on the test. The lateness varies between runs on the same machine (likely how warm the file cache is). A run on a fast host that logs the old warning on main and then written late with waited_ms over 8 here would settle it.

Notes

  • A worker waits for at most 250 ms per late request. In the measured bursts that is 3 to 15 ms per request.
  • Claim: #1633.

No game data attached: counts, timings and log lines only.

AI-assisted.

🤖 Generated with Claude Code

**@⁠JurajSimicevic** on GitHub · 2026-11-25 11:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2338) `JurajSimicevic:dstorage/late-page-lists` → `main` · +26 −6 · 1 files · 1 commits · closed without merging ## Problem A DirectStorage request into physical pages (`PAGE_DESTINATION`) whose page list still names page 0 is read again for 8 ms (#1726) and then fails with `E_INVALIDARG`. The title never looks at a request's result, so each failure is a model or texture left unwritten. #2181 sees untextured geometry after such a burst. On a fast host the data is read and inflated before the title has filled the list, and 8 ms is not always enough. On this host (Windows 11, RTX 5080, NVMe), three world loads on `main` `940d32f`, with the typed-UAV check of #1775/#1763 to boot, logged "a destination's physical pages could not be written; its request fails" **391, 45 and 24 times**, each time in one burst while the world loads. ## What the failed requests had in common (local diagnostics, not in this PR) - In all 40 failures logged in detail, the page list still named page 0 when the request failed, in full or in part. The other entries were pages the title holds. No page was freed, out of range or failing to map. - 24 lists were watched after their request had failed. **Every one was filled 3 to 6.5 ms after the 8 ms ran out**, and all the pages were ones the title holds. The data had been read and inflated; only the wait was too short. ## Change - The list is read again for up to **250 ms** (`LATE_LIST_WAIT`) instead of 8 tries of 1 ms. A list that still names page 0 after that fails as before. - The "written late" log line also says how long the read waited (`waited_ms`). - Tests: #1726's test is now a helper with two cases, the list filled 2 ms and 40 ms after the request starts. The 40 ms case fails with the 8 ms wait (`E_INVALIDARG`, `-2147024809`) and passes with this change. `crates/victory-hle/src/modules/dstorage.rs` only, +26 −6. ## Tested - `cargo test -p victory-hle --locked`: 144 passed. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. No new rustfmt hunks. - In the title, with this change (two runs, RTX 5080, diag build): | run | requests failed | lists written late | waited | |---|---|---|---| | 1 | 0 | none logged | – | | 2 | 0 | 16 to 31 (the counter logs at powers of two) | 5 to 6 ms | The limit, said plainly: in both runs the race either did not happen or ended within 8 ms, which the old wait also covers. So the in-title runs show that this changes nothing for the worse. The case it fixes, lists later than 8 ms, rests on the diagnostics above and on the test. The lateness varies between runs on the same machine (likely how warm the file cache is). A run on a fast host that logs the old warning on `main` and then `written late` with `waited_ms` over 8 here would settle it. ## Notes - A worker waits for at most 250 ms per late request. In the measured bursts that is 3 to 15 ms per request. - Claim: #1633. No game data attached: counts, timings and log lines only. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A request into physical pages whose page list still names page 0 was
read again for 8 ms before it failed (#1726). On a fast host the data is
read and inflated before the title fills the list: on one Windows 11
host, 24 to 391 such requests failed per world load, each a model or
texture left unwritten. Every failed list named page 0, and the 24 that
were watched after failing were filled 3 to 6.5 ms after the 8 ms had
run out, all with pages the title holds.

The list is now read again for up to 250 ms. The written-late log line
says how long the read waited. A new test fills the list 40 ms after
the request starts; with the 8 ms wait it fails with E_INVALIDARG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:43 +00:00
github-bot closed this pull request 2026-11-26 05:02:43 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 11:11 UTC · original

Independent native Windows check on 77d5d1b. I copied only the two test cases onto 940d32f. The 2 ms case passed there and the 40 ms case returned E_INVALIDARG (0x80070057). Both tests passed five consecutive runs on the exact PR head, including the physical-page byte comparison. The full victory-hle library suite passed all 144 tests. The runs used synthetic requests and mapped pages.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 11:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7160721897) Independent native Windows check on `77d5d1b`. I copied only the two test cases onto `940d32f`. The 2 ms case passed there and the 40 ms case returned `E_INVALIDARG` (`0x80070057`). Both tests passed five consecutive runs on the exact PR head, including the physical-page byte comparison. The full `victory-hle` library suite passed all 144 tests. The runs used synthetic requests and mapped pages.
Author
Owner

@⁠JurajSimicevic on GitHub · 2026-11-25 12:31 UTC · original

In-title result with this PR's change: lists filled 62 to 84 ms late, all written

The PR said the in-title runs after the fix had not yet shown a list later than 8 ms. A longer run has now shown some.

Setup: RTX 5080, diag build of main 940d32f with this PR's commit (the same diff, cherry-picked), #1762, and #1968's program A skipped so the world keeps running. One run of 15 minutes, through the prologue into the first gameplay prompts.

  • written late lines: five, all in one burst while the world loaded. The counter logs at powers of two, so between 16 and 31 lists were filled late.
  • waited_ms on the logged ones: 62, 65, 68, 79, 84. The 8 ms wait on main would have failed every one of them with E_INVALIDARG.
  • a destination's physical pages could not be written: 0.

So the late lists are not limited to the 3 to 6.5 ms seen first. While the title loads they can trail the request by tens of milliseconds, and the 250 ms bound covers that with room to spare. The test's 40 ms case is still below what the title did here. I can raise it to 100 ms if you prefer a case above the longest wait seen.

No game data: log counts and timings only.

AI-assisted.

**@⁠JurajSimicevic** on GitHub · 2026-11-25 12:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7162501971) **In-title result with this PR's change: lists filled 62 to 84 ms late, all written** The PR said the in-title runs after the fix had not yet shown a list later than 8 ms. A longer run has now shown some. Setup: RTX 5080, diag build of `main` `940d32f` with this PR's commit (the same diff, cherry-picked), #1762, and #1968's program A skipped so the world keeps running. One run of 15 minutes, through the prologue into the first gameplay prompts. - `written late` lines: five, all in one burst while the world loaded. The counter logs at powers of two, so between 16 and 31 lists were filled late. - `waited_ms` on the logged ones: 62, 65, 68, 79, 84. The 8 ms wait on `main` would have failed every one of them with `E_INVALIDARG`. - `a destination's physical pages could not be written`: 0. So the late lists are not limited to the 3 to 6.5 ms seen first. While the title loads they can trail the request by tens of milliseconds, and the 250 ms bound covers that with room to spare. The test's 40 ms case is still below what the title did here. I can raise it to 100 ms if you prefer a case above the longest wait seen. No game data: log counts and timings only. AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:23 UTC · original · edited 2026-11-25 15:59 UTC

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-hle/src/modules/dstorage.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge-candidate) was for an older state of main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7166781388) · edited 2026-11-25 15:59 UTC <!-- victory-triage v1 head=77d5d1ba0f5dbb6d2c95c84f58e34be4688a77c9 verdict=needs-rebase at=2026-11-25T15:58:50Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-hle/src/modules/dstorage.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge-candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠JurajSimicevic on GitHub · 2026-11-25 16:02 UTC · original

Closing this: eddde73 on main removes the cause instead of waiting it out. Reads into physical pages now wait for the title's Submit, which is where the title fills the page table. It measured 0 failed and 0 late writes after the change.

Our in-title numbers fit that explanation. The 62 to 84 ms lists in my comment above all came in one burst while the world loaded, which matches a queue that submits itself at half capacity before the title's Submit. A longer retry bound only matters if a list is still empty after Submit, and nothing here shows that. If it shows up later, it can come back as a small change on top of eddde73.

Thanks @⁠andrewpozdnakov7-jpg and @⁠catminou4 for checking it.

AI-assisted.

**@⁠JurajSimicevic** on GitHub · 2026-11-25 16:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7167546931) Closing this: eddde73 on `main` removes the cause instead of waiting it out. Reads into physical pages now wait for the title's Submit, which is where the title fills the page table. It measured 0 failed and 0 late writes after the change. Our in-title numbers fit that explanation. The 62 to 84 ms lists in my comment above all came in one burst while the world loaded, which matches a queue that submits itself at half capacity before the title's Submit. A longer retry bound only matters if a list is still empty after Submit, and nothing here shows that. If it shows up later, it can come back as a small change on top of eddde73. Thanks @⁠andrewpozdnakov7-jpg and @⁠catminou4 for checking it. AI-assisted.

Pull request closed

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!2338
No description provided.