Fix #2503: tell GPU write watch before DirectStorage page writes #3063

Closed
github-bot wants to merge 1 commit from github-bot/gh-3063 into main AGit
Owner

@⁠tharun-37 on GitHub · 2026-11-26 05:57 UTC · original
tharun-37:fix/directstorage-write-watch-fresh → main · +32 −11 · 1 files · 1 commits · closed without merging

Fix #2503: tell GPU write watch before DirectStorage page writes

write_physical and PageWindow called kernel_will_write (watch::writing) after writing through our own views. The watch must be told before the write so it saves the page's original bytes and keeps the guarded blocks open during the write.

Now report_written returns Writing guards that stay alive during the write, write_physical reports current views after the write, and PageWindow holds pre-write guards until dropped and reports views currently showing the pages on drop.

Fixes #2503.

Supersedes closed PR #3037 (same fix, rebased on clean upstream/main with unrelated aliases changes removed, and with the pre-write + post-write view reporting both included per reviewer feedback).

**@⁠tharun-37** on GitHub · 2026-11-26 05:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/3063) `tharun-37:fix/directstorage-write-watch-fresh` → `main` · +32 −11 · 1 files · 1 commits · closed without merging Fix #2503: tell GPU write watch before DirectStorage page writes write_physical and PageWindow called kernel_will_write (watch::writing) after writing through our own views. The watch must be told before the write so it saves the page's original bytes and keeps the guarded blocks open during the write. Now report_written returns Writing guards that stay alive during the write, write_physical reports current views after the write, and PageWindow holds pre-write guards until dropped and reports views currently showing the pages on drop. Fixes #2503. Supersedes closed PR #3037 (same fix, rebased on clean upstream/main with unrelated aliases changes removed, and with the pre-write + post-write view reporting both included per reviewer feedback).
write_physical and PageWindow called kernel_will_write (watch::writing)
after writing through our own views. The watch must be told before the
write so it saves the page's original bytes and keeps the guarded blocks
open during the write.

Now report_written returns Writing guards that stay alive during the
write, write_physical reports current views after the write, and
PageWindow holds pre-write guards until dropped and reports views
currently showing the pages on drop.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:27:53 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 06:17 UTC · original · edited 2026-11-26 07:20 UTC

Automated triage for the maintainers.

Proposed close: duplicate of #2504. The head has not changed. Passing CI and approvals from other contributors don't change the comparison. #2504 fixes the same issue (#2503) the same way in crates/victory-hle/src/modules/xmem.rs (report_written, write_physical, PageWindow). It is still open and merges cleanly. It also has a regression test with real write-watch trackers, and this PR has none, so reverting the ordering here would still pass the suite. Thanks for removing the attribution from the description.

This PR will be closed in 48 hours unless the author pushes a change, or a maintainer removes the label triage: proposed close. Anything #2504 is missing is best raised as a review comment there.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 06:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3063#issuecomment-7184284336) · edited 2026-11-26 07:20 UTC <!-- victory-triage v1 head=3ce6a8934ac299dec2b90b71941652a332c10548 verdict=proposed-close at=2026-11-26T06:19:30Z --> Automated triage for the maintainers. **Proposed close: duplicate of #2504.** The head has not changed. Passing CI and approvals from other contributors don't change the comparison. #2504 fixes the same issue (#2503) the same way in `crates/victory-hle/src/modules/xmem.rs` (`report_written`, `write_physical`, `PageWindow`). It is still open and merges cleanly. It also has a regression test with real write-watch trackers, and this PR has none, so reverting the ordering here would still pass the suite. Thanks for removing the attribution from the description. This PR will be closed in 48 hours unless the author pushes a change, or a maintainer removes the label `triage: proposed close`. Anything #2504 is missing is best raised as a review comment there. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠tharun-37 on GitHub · 2026-11-26 06:18 UTC · original

Removed the decompiled-code attribution from the description per the asset policy.

This PR is CI-passing and APPROVED by Dukestar69 (14 xmem tests pass, clippy clean, xtask policy ok). It fixes #2503 — DirectStorage page writes through our own views were not seen by the GPU write watch because kernel_will_write was called after the write instead of before. Now pre-write guards stay open during the write, and post-write reporting covers views the title remapped mid-write.

**@⁠tharun-37** on GitHub · 2026-11-26 06:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/3063#issuecomment-7184299905) Removed the decompiled-code attribution from the description per the asset policy. This PR is CI-passing and APPROVED by Dukestar69 (14 xmem tests pass, clippy clean, xtask policy ok). It fixes #2503 — DirectStorage page writes through our own views were not seen by the GPU write watch because kernel_will_write was called after the write instead of before. Now pre-write guards stay open during the write, and post-write reporting covers views the title remapped mid-write.
github-bot closed this pull request 2026-11-26 11:10:13 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 06:09 UTC · original · approved these changes

Tested locally merged onto origin/main (63bcca4) on Windows 11 x64:

  • Diff review: Holding KernelWrite write-watch guards open across write_physical and PageWindow (obtained before writing and dropped after the write completes, while still reporting post-write views in case the title remapped a page during the write) cleanly fixes #2503 so DirectStorage page writes do not fault on guarded pages.
  • cargo test -p victory-hle xmem: 14 passed, 0 failed (including page_windows_report_where_the_pages_show_when_done).
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 06:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/3063#pullrequestreview-6069315232) · **approved these changes** Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - Diff review: Holding `KernelWrite` write-watch guards open across `write_physical` and `PageWindow` (obtained before writing and dropped after the write completes, while still reporting post-write views in case the title remapped a page during the write) cleanly fixes #2503 so DirectStorage page writes do not fault on guarded pages. - `cargo test -p victory-hle xmem`: 14 passed, 0 failed (including `page_windows_report_where_the_pages_show_when_done`). - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 06:32 UTC · original · approved these changes

Verified: report_written now returns the KernelWrite guards so they live across the write (the watch must be told before, not after, so it saves pre-write bytes and keeps guarded blocks open); write_physical also reports at post-write views to cover a remap mid-write; PageWindow holds guards for its lifetime and reports at current views on drop. Clean final iteration of the #2503 fix.

**@⁠kotekompotek** on GitHub · 2026-11-26 06:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/3063#pullrequestreview-6069536740) · **approved these changes** Verified: report_written now returns the KernelWrite guards so they live across the write (the watch must be told before, not after, so it saves pre-write bytes and keeps guarded blocks open); write_physical also reports at post-write views to cover a remap mid-write; PageWindow holds guards for its lifetime and reports at current views on drop. Clean final iteration of the #2503 fix.
Author
Owner

@⁠tharun-37 on GitHub · 2026-11-26 09:58 UTC · original

Closing to focus on new issues

**@⁠tharun-37** on GitHub · 2026-11-26 09:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/3063#issuecomment-7188745409) Closing to focus on new issues

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