Watch: what was put in beside a guard goes with the memory (part of #321) #328

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

@⁠felicerosella on GitHub · 2026-11-26 17:17 UTC · original
felicerosella:fix/beside-forgotten → main · +55 −2 · 1 files · 1 commits · closed without merging

Part of #321: the confirmed BESIDE leftover described there.

put_beside sets BESIDE at every view of the page, and only an asking (guard()'s BESIDE.take) cleared it. A remap, an unmap or a free of that memory cleared the block's other notes (absent, held, foreign, aliased, the views) but not this bit nor the block's PUT share. The next memory at the address took the bit as its own and was told as written before anything wrote to it. In the runtime that costs a spare refresh. In the tests, whose fresh views often land at addresses another test just gave back, it is one of the leftovers behind #321.

  • forget_beside(first, last) clears the bit and the PUT share of the blocks of a range.
  • title_memory_changed (so title_memory_remapped and title_memory_unmapping) and title_memory_freed call it, next to forget_views. Both run under the mapping lock that put_beside takes with try_read, so they cannot interleave with a put.

Unlike #277's title_memory_made_anew, this is not test-only and covers two_views()/drop_views() too (drop_views tells title_memory_remapped). The two don't conflict.

Test: what_was_put_beside_goes_with_the_memory puts bytes beside a guard, frees one view (its mark goes, the other's stays), then drops both (no mark left). It doesn't depend on address reuse. Its retry on Cannot is bounded at 30 s, as in #315.

Results (RTX 4070 SUPER, driver 621.24, Ryzen 7 7800X3D, 64 GB, Windows 11 26200, main at c9c932c):

  • New test alone: passes with the fix, fails without it.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean apart from main's own unnecessary_mut_passed in title_memory_remapped (#324).
  • cargo test -p victory-gpu --lib, parallel, 20 runs each:
clean runs failures
this PR 13/20 no_write_is_lost_with_port_7 5, unchanged_ranges_are_known 1, freed_memory_leaves_no_notes 1
main 15/20 no_write_is_lost_with_port_7 2, unchanged_ranges_are_known 1, other_memory_at_a_guarded_address_keeps_its_protection 1, records_copied_as_bytes_are_made_at_the_next_sync 1

So this is a correctness fix for one mechanism. On this machine it doesn't measurably reduce the random failures: the rest of #321 (stale foreign/PUBLISHED, which #277 covers) is still there. The new test never failed in the parallel runs. no_write_is_lost_with_port_7 is a separate cross-test failure, which I'll report on its own.

AI-assisted: yes (Claude Code)

**@⁠felicerosella** on GitHub · 2026-11-26 17:17 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/328) `felicerosella:fix/beside-forgotten` → `main` · +55 −2 · 1 files · 1 commits · closed without merging Part of #321: the confirmed `BESIDE` leftover described there. `put_beside` sets `BESIDE` at every view of the page, and only an asking (`guard()`'s `BESIDE.take`) cleared it. A remap, an unmap or a free of that memory cleared the block's other notes (`absent`, `held`, `foreign`, `aliased`, the views) but not this bit nor the block's `PUT` share. The next memory at the address took the bit as its own and was told as written before anything wrote to it. In the runtime that costs a spare refresh. In the tests, whose fresh views often land at addresses another test just gave back, it is one of the leftovers behind #321. - `forget_beside(first, last)` clears the bit and the `PUT` share of the blocks of a range. - `title_memory_changed` (so `title_memory_remapped` and `title_memory_unmapping`) and `title_memory_freed` call it, next to `forget_views`. Both run under the mapping lock that `put_beside` takes with `try_read`, so they cannot interleave with a put. Unlike #277's `title_memory_made_anew`, this is not test-only and covers `two_views()`/`drop_views()` too (`drop_views` tells `title_memory_remapped`). The two don't conflict. **Test:** `what_was_put_beside_goes_with_the_memory` puts bytes beside a guard, frees one view (its mark goes, the other's stays), then drops both (no mark left). It doesn't depend on address reuse. Its retry on `Cannot` is bounded at 30 s, as in #315. **Results** (RTX 4070 SUPER, driver 621.24, Ryzen 7 7800X3D, 64 GB, Windows 11 26200, `main` at `c9c932c`): - New test alone: passes with the fix, fails without it. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean apart from `main`'s own `unnecessary_mut_passed` in `title_memory_remapped` (#324). - `cargo test -p victory-gpu --lib`, parallel, 20 runs each: | | clean runs | failures | |---|---|---| | this PR | 13/20 | `no_write_is_lost_with_port_7` 5, `unchanged_ranges_are_known` 1, `freed_memory_leaves_no_notes` 1 | | `main` | 15/20 | `no_write_is_lost_with_port_7` 2, `unchanged_ranges_are_known` 1, `other_memory_at_a_guarded_address_keeps_its_protection` 1, `records_copied_as_bytes_are_made_at_the_next_sync` 1 | So this is a correctness fix for one mechanism. On this machine it doesn't measurably reduce the random failures: the rest of #321 (stale `foreign`/`PUBLISHED`, which #277 covers) is still there. The new test never failed in the parallel runs. `no_write_is_lost_with_port_7` is a separate cross-test failure, which I'll report on its own. AI-assisted: yes (Claude Code)
put_beside sets BESIDE at every view of the page, and only an asking
(guard's BESIDE.take) cleared it. A remap, an unmap or a free of the
memory cleared the block's other notes but not this bit nor its PUT
share, so the next memory at the address took the bit as its own and
was told as written before anything wrote to it. In the runtime that
costs a spare refresh; in the tests, whose fresh views often land at
addresses another test just gave back, it is one of the leftovers
behind the random failures of #321.

forget_beside clears the bit and the share of the blocks of a range;
title_memory_changed (remapped, unmapping) and title_memory_freed call
it where they forget the views.

Test: what_was_put_beside_goes_with_the_memory puts bytes beside a
guard, frees one view (its mark goes, the other's stays) and drops
both (no mark left). It fails without the fix and passes with it.

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

@⁠felicerosella on GitHub · 2026-11-26 20:11 UTC · original

Closing in favour of #347, which includes this fix (clearing BESIDE on remap/unmap/free) along with the rest of #321. Happy to reopen if that one doesn't go in.

**@⁠felicerosella** on GitHub · 2026-11-26 20:11 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/328#issuecomment-7202391887) Closing in favour of #347, which includes this fix (clearing `BESIDE` on remap/unmap/free) along with the rest of #321. Happy to reopen if that one doesn't go in.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.