fix(victory-hle): stabilize and restore real remapping in xmem remap-gap test #393

Manually merged
github merged 2 commits from github-bot/gh-393 into main 2026-11-26 16:51:23 +00:00 AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 15:42 UTC · original
Lewandox:fix/victory-hle-xmem-flaky-remap-test → main · +22 −10 · 1 files · 2 commits · merged 2026-11-26 16:49 UTC

Summary

Fixes the flaky victory-hle xmem test a_read_in_place_never_meets_the_gap_of_a_remapping noted in docs/rust-full-status.md ("fails about 3 times in 8 on the unmodified file"):

  • Root cause:
    1. map_pages's remap_same() fast path skips unmapping/remapping when the exact same page slice [pages[0], pages[1], pages[2]] is passed repeatedly, making the 2,000-iteration loop finish in sub-millisecond time without exercising the unmap/remap gap at all.
    2. The test did not synchronize reader thread startup before starting the loop and setting stop = true, so on contended or fast runs the main thread could finish and stop the reader before it executed a single read (reads == 0), failing assert!(reader.join()... > 0).
  • Fix (third_party/victory/crates/victory-hle/src/modules/xmem.rs):
    • Allocate 4 physical pages and alternate between two non-consecutive orders ([pages[0], pages[2], pages[1]] and [pages[0], pages[3], pages[1]]) so each page keeps a single-page placeholder, remap_same's fast path never short-circuits, and pages[0] (byte 1) stays mapped at a while every call genuinely unmaps and remaps a under title_memory_remapping_range.
    • Synchronize reader thread startup with std::sync::Barrier::new(2) (with Release/Acquire ordering on stop) and keep reading until stop is set after at least one read.

Verification

  • cargo test --release -p victory-hle --features diagnostics --lib xmem (20 consecutive parallel runs: 20/20 passed)
  • cargo test -p victory-hle --features diagnostics --lib xmem (all xmem tests passed)
  • cargo xtask policy (in third_party/victory): asset policy: 214 files ok
**@⁠Lewandox** on GitHub · 2026-11-26 15:42 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/393) `Lewandox:fix/victory-hle-xmem-flaky-remap-test` → `main` · +22 −10 · 1 files · 2 commits · merged 2026-11-26 16:49 UTC ## Summary Fixes the flaky `victory-hle` `xmem` test `a_read_in_place_never_meets_the_gap_of_a_remapping` noted in `docs/rust-full-status.md` ("fails about 3 times in 8 on the unmodified file"): - **Root cause**: 1. `map_pages`'s `remap_same()` fast path skips unmapping/remapping when the exact same page slice `[pages[0], pages[1], pages[2]]` is passed repeatedly, making the 2,000-iteration loop finish in sub-millisecond time without exercising the unmap/remap gap at all. 2. The test did not synchronize reader thread startup before starting the loop and setting `stop = true`, so on contended or fast runs the main thread could finish and stop the reader before it executed a single read (`reads == 0`), failing `assert!(reader.join()... > 0)`. - **Fix (`third_party/victory/crates/victory-hle/src/modules/xmem.rs`)**: - Allocate 4 physical pages and alternate between two non-consecutive orders (`[pages[0], pages[2], pages[1]]` and `[pages[0], pages[3], pages[1]]`) so each page keeps a single-page placeholder, `remap_same`'s fast path never short-circuits, and `pages[0]` (byte `1`) stays mapped at `a` while every call genuinely unmaps and remaps `a` under `title_memory_remapping_range`. - Synchronize reader thread startup with `std::sync::Barrier::new(2)` (with `Release`/`Acquire` ordering on `stop`) and keep reading until `stop` is set after at least one read. ## Verification - `cargo test --release -p victory-hle --features diagnostics --lib xmem` (20 consecutive parallel runs: 20/20 passed) - `cargo test -p victory-hle --features diagnostics --lib xmem` (all xmem tests passed) - `cargo xtask policy` (in `third_party/victory`): `asset policy: 214 files ok`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:44:29 +00:00
github manually merged commit 71178684e1 into main 2026-11-26 16:51:23 +00:00
github-bot changed target branch from main to gh-pr/393/base 2026-11-26 16:51:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.