xmem tests: keep the chunked-span aperture inside one span chunk #659
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/659"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-12-02T19:25:32Z.
Summary
Under GE-Proton11-14's Wine,
tuxbox-xmem's unit tests fail about half the time with default test threads. Atc1139ab2, with the test binary run from wherecargo xwin testputs it, 14 of 30 runs failed. The same five tests fail every time:chunked_private_span_shares_allocation_and_scans_across_uncommitted_gap:single chunked PrivateSpan covers all 3 sparse pages, left: 2, right: 1(physical_tracking.rs:888)held_pages_are_not_bridged_when_host_does_not_watch_held_pages,held_pages_keep_their_cpu_watch_where_the_host_allows_it,untracked_ranges_do_not_put_their_unheld_pages_on_the_scan_listandwatched_pages_of_one_allocation_are_scanned_as_one_run_across_small_gapsthen fail withPoisonErroronPOOL.lock().Cause: the test reserves a 16-page aperture wherever the OS puts it, maps pages 0, 4 and 15, and expects one private span.
Pool::private_span_boundsrounds spans toPRIVATE_SPAN_CHUNK(64 pages, 4 MiB) boundaries of the address, so an aperture that straddles a boundary gets two spans. That is what the provider is meant to do; the test's assumption is what fails. The assertion evaluatesPOOL.lock()insideassert_eq!, so it panics while holding the lock, which takes the four tracking tests down with it.Where the aperture lands depends on the build and, under this Wine, on the length of the path the test binary runs from. In a local build with an
eprintln!of the address (not part of this PR), I ran the binary from paths of different lengths. All 14 runs where the aperture straddled a 4 MiB boundary failed, and all 37 others passed (5 more runs interleaved their output and couldn't be read). From paths shorter than 56 characters it never straddled here. From most longer paths it often did, including cargo's own output path in this checkout.The fix is in the test only: it sets aside any reservation that straddles a 64-page boundary, keeps the first one that doesn't, and releases the ones it set aside. No provider code changes.
Follows the test cleanup on #369. The Miri job on this PR stays red until #658 lands (two new tests reach
VirtualAlloc2without the Miri ignore); with both applied, CI's Miri line for xmem gives0 failed; 50 ignoredhere (nightly 2026-11-29; CI pins nightly-2026-11-03).This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Tested
Run the checks relevant to this change.
No Lanes scenario covers this because it changes a unit test only; nothing a game or Lanes runs changes. I didn't launch the game.
GPU, driver and backend: none (CPU-only).
The
Evidence:linetuxbox.py checkprints last, one per card (it names the commit it tested; run it on this pull request's head):(The one not run is the synthetic shaders through the runtime's DXC flags, which needs a Linux DXC that wasn't on
PATHfor this run.)Commands run and their results:
c1139ab2) failedEvery failure on main includes the five tests above.
The one failure with this PR has a different cause and isn't fixed here. In that run
physical_pages::backing::tests::gpu_pool_then_plain_cpu_view_upgrades_backing_and_keeps_mem_privatefailed first (physical_backing.rs:383,acquire_physical_backingon the second GPU alias returned 0,left: 0, right: 1) and left four spans in the pool, so this test then counted 5 spans and the same lock poisoning followed. I've seen that failure about once in 100 runs, on main too, and haven't traced it. One more run failed in an earlier 36-run sweep whose logs I didn't keep.Also run:
cargo +1.95.0 clippy --locked --target x86_64-pc-windows-msvc --workspace --all-targets -- -D warningsandcargo fmt --all --check: pass.--test-threads=1, from the same 141-character path, 10 of 10 runs passed.Checks
CI runs the code checks: the Python and Rust unit tests, the translator tests through DXC, a Windows typecheck, clippy, formatting, rustdoc, and Miri on the providers. It has no GPU.
If this pull request changes evidence JSON, regenerate the results table and the progress map and include both files:
This pull request changes no evidence JSON.