watch: a hole noted absent in a race with its unmapping is known as a placeholder at the next asking #3603

Closed
ACSchafer wants to merge 1 commit from upstream-pr/3603 into main
ACSchafer commented 2026-11-30 01:36:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ACSchafer on 2026-11-30T01:36:35Z.


What it changes

A block whose view went between protect's two questions (committed? a placeholder?) was noted absent and not held. Nothing told of it again, so every asking of its range asked Windows about it and the bits never answered for it. No write was lost, but it cost a question to Windows per asking, and no_mapping_is_lost_between_askers failed its last check (published(at, end)) on some runs.

guard() now takes such a hole for a placeholder when Windows says it is one and holds it (held, and PUBLISHED when light()). Blocks the runtime told of memory in (title_memory_allocated) are the exception: they stay asked about, as before. A new set, Guards::told, remembers them until a mapping, a free, or a kernel write there tells of the block.

The placeholder question is asked with the guards' lock not held, like the others in guard(), so VICTORY_KEEP_GUARD_LOCK behaves as before.

How it was tested

  • GPU and profile: not applicable (write-watch bookkeeping; no rendering change)
  • Before: no_mapping_is_lost_between_askers run 2,400 times, 4 at a time, on upstream/main @ 41adb551: 36 failed (1.5 %), each assertion failed: super::published(at, end)
  • After: the same 2,400 runs, side by side with the above: 0 failed
  • New test a_hole_noted_absent_in_a_race_is_known_at_the_next_asking makes the state the race leaves and checks the next asking; it fails without the change
  • For shader changes, the wave sizes tested: not applicable
  • cargo test passed for the crates it touches: yes. cargo test -p victory-gpu --lib watch:: (66 passed). cargo clippy -p victory-gpu --all-targets, with and without --all-features, adds no warnings.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: none for the placeholder bookkeeping. (#2655, #3367 and #3105 touch the same file, in the lock and the hole cache.)
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5557426470 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3603). Originally posted by [ACSchafer](https://github.com/ACSchafer) on 2026-11-30T01:36:35Z. --- ## What it changes A block whose view went between `protect`'s two questions (committed? a placeholder?) was noted absent and not held. Nothing told of it again, so every asking of its range asked Windows about it and the bits never answered for it. No write was lost, but it cost a question to Windows per asking, and `no_mapping_is_lost_between_askers` failed its last check (`published(at, end)`) on some runs. `guard()` now takes such a hole for a placeholder when Windows says it is one and holds it (`held`, and `PUBLISHED` when `light()`). Blocks the runtime told of memory in (`title_memory_allocated`) are the exception: they stay asked about, as before. A new set, `Guards::told`, remembers them until a mapping, a free, or a kernel write there tells of the block. The placeholder question is asked with the guards' lock not held, like the others in `guard()`, so `VICTORY_KEEP_GUARD_LOCK` behaves as before. ## How it was tested - GPU and profile: not applicable (write-watch bookkeeping; no rendering change) - Before: `no_mapping_is_lost_between_askers` run 2,400 times, 4 at a time, on `upstream/main` @ 41adb551: **36 failed** (1.5 %), each `assertion failed: super::published(at, end)` - After: the same 2,400 runs, side by side with the above: **0 failed** - New test `a_hole_noted_absent_in_a_race_is_known_at_the_next_asking` makes the state the race leaves and checks the next asking; it fails without the change - For shader changes, the wave sizes tested: not applicable - `cargo test` passed for the crates it touches: yes. `cargo test -p victory-gpu --lib watch::` (66 passed). `cargo clippy -p victory-gpu --all-targets`, with and without `--all-features`, adds no warnings. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: none for the placeholder bookkeeping. (#2655, #3367 and #3105 touch the same file, in the lock and the hole cache.)
copilot-pull-request-reviewer[bot] commented 2026-11-30 01:36:48 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-30T01:36:48Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6105953184 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3603#pullrequestreview-6105953184). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-30T01:36:48Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Tan7rex commented 2026-12-01 14:37:09 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Tan7rex on 2026-12-01T14:37:09Z.


Tested on Windows 11 Pro (build 26100), RTX 4090, with this PR's change applied onto current main (5fabb46e). The branch is 550 commits behind and conflicts in guard(): main dropped VICTORY_KEEP_GUARD_LOCK in 8bd49cdc, so I resolved it as if !unsure.is_empty() { with the PR's comment and let mut placeholders kept. Release test binary for victory-gpu --lib.

no_mapping_is_lost_between_askers, failures:

How it was run main 5fabb46e main + this PR
the test alone, 4 processes at a time, 600 runs 1 failed 0 failed
watch:: filter, 300 runs 0 failed 0 failed
whole lib, 60 runs 0 failed 0 failed

On this machine the failure is too rare (1 in 960 runs on main) to show the fix working. The new test a_hole_noted_absent_in_a_race_is_known_at_the_next_asking passes.

Possible regression, small numbers: watch::tests::a_late_fault_leaves_the_guard_taken_since failed 5 of 600 watch:: runs with the PR (4 then 1, in two batches of 300) and 0 of 600 on main. In 60 whole-lib runs it also failed once with the PR, against 0 on main. watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock failed once in 300 with the PR, against 0 on main. Worth a look, since guard() now holds placeholders it used to leave absent.

Not tested: the game.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7314552227 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3603#issuecomment-7314552227). Originally posted by [Tan7rex](https://github.com/Tan7rex) on 2026-12-01T14:37:09Z. --- Tested on Windows 11 Pro (build 26100), RTX 4090, with this PR's change applied onto current `main` (5fabb46e). The branch is 550 commits behind and conflicts in `guard()`: `main` dropped `VICTORY_KEEP_GUARD_LOCK` in 8bd49cdc, so I resolved it as `if !unsure.is_empty() {` with the PR's comment and `let mut placeholders` kept. Release test binary for `victory-gpu --lib`. `no_mapping_is_lost_between_askers`, failures: | How it was run | `main` 5fabb46e | `main` + this PR | |---|---|---| | the test alone, 4 processes at a time, 600 runs | 1 failed | 0 failed | | `watch::` filter, 300 runs | 0 failed | 0 failed | | whole lib, 60 runs | 0 failed | 0 failed | On this machine the failure is too rare (1 in 960 runs on `main`) to show the fix working. The new test `a_hole_noted_absent_in_a_race_is_known_at_the_next_asking` passes. Possible regression, small numbers: `watch::tests::a_late_fault_leaves_the_guard_taken_since` failed **5 of 600** `watch::` runs with the PR (4 then 1, in two batches of 300) and **0 of 600** on `main`. In 60 whole-lib runs it also failed once with the PR, against 0 on `main`. `watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock` failed once in 300 with the PR, against 0 on `main`. Worth a look, since `guard()` now holds placeholders it used to leave absent. Not tested: the game.
Tan7rex commented 2026-12-01 15:14:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Tan7rex on 2026-12-01T15:14:15Z.


A correction to my earlier comment: a_late_fault_leaves_the_guard_taken_since also fails on main. In 60 more whole-library runs it failed once on main 5fabb46e (and 2 times with #3902, which doesn't touch watch.rs), and #4704 is open for exactly this test. So the 5 of 600 I saw with this PR (against 0 of 600 on main) is weaker evidence of a regression than I made it sound. It may only be the existing flake.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7315574294 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3603#issuecomment-7315574294). Originally posted by [Tan7rex](https://github.com/Tan7rex) on 2026-12-01T15:14:15Z. --- A correction to my earlier comment: `a_late_fault_leaves_the_guard_taken_since` also fails on `main`. In 60 more whole-library runs it failed once on `main` 5fabb46e (and 2 times with #3902, which doesn't touch `watch.rs`), and #4704 is open for exactly this test. So the 5 of 600 I saw with this PR (against 0 of 600 on `main`) is weaker evidence of a regression than I made it sound. It may only be the existing flake.
trustno1-coder commented 2026-12-01 18:50:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:50:32Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321652664 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3603#issuecomment-7321652664). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:50:32Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!3603
No description provided.