Skip to content

xmem tests: unmap only the mapped pages after the tile hold test - #665

Open
snoozedDev wants to merge 1 commit into
brcly:mainfrom
snoozedDev:gleaner/tuxbox-11-xmem-tests-unmap-only-the-mapped-pages-i
Open

snoozedDev wants to merge 1 commit into
brcly:mainfrom
snoozedDev:gleaner/tuxbox-11-xmem-tests-unmap-only-the-mapped-pages-i

Conversation

@snoozedDev

Copy link
Copy Markdown
Contributor

Summary

Since #660, the tuxbox-xmem unit tests fail on every run on main under GE-Proton11-14's Wine. gpu_tile_hold_keeps_the_whole_private_span_mapped unmaps page 1 of its four-page aperture, and its clean-up then unmaps all four in one call. An unmap refuses a range with an unmapped page in it (unmap_single_private_span_range returns ERROR_INVALID_ADDRESS), so map(aperture, 4, null) returns NULL at physical_backing.rs:248. The test panics while holding POOL, and six more tests fail on the poisoned lock.

The change: the clean-up unmaps page 0 and pages 2 and 3 separately. Only that test's clean-up changes. Its assertions about the hold are unchanged and pass: the sibling page stays committed while the hold lives and is reserved again after release.

I left the provider alone. Whether an unmap should skip pages that are already unmapped is your call; the current check is explicit, so I treated it as intended.

I didn't run the game. Nothing here changes what the game runs.

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.

  • The checks relevant to this change passed
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below
  • Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: both. I didn't run the xmem, lanes-selftest or D3D12 buffer controls on either card.

The first box is unticked because the GPU suites the table names for runtime/xmem/ were not run. This PR only changes a unit test, so no Lanes scenario applies. The xmem unit tests ran under Wine, and tuxbox.py check --no-gpu passed (below).

GPU, driver and backend: none (CPU-only unit tests under GE-Proton11-14's Wine).

The Evidence: line tuxbox.py check prints last, one per card (it names the commit it tested; run it on this pull request's head):

Evidence: TuxBox check of 527e52b6d3a9, no uncommitted changes, no GPU checks: 12 passed, 0 failed, 1 not run

(The one not run is the synthetic shaders through the runtime's DXC flags; no Linux DXC was on PATH.)

Commands run and their results:

cargo +1.95.0 xwin test --locked --no-run --target x86_64-pc-windows-msvc -p tuxbox-xmem
WINEPREFIX=<scratch> WINEDEBUG=-all WINEDLLOVERRIDES="mscoree,mshtml=d" \
  <GE-Proton11-14>/files/bin/wine <test exe> [filter] [--test-threads=1]
main (a789a4e) this PR
the test alone 0 of 3 pass 3 of 3
whole binary, --test-threads=1 0 of 10 (48 passed, 7 failed) 10 of 10 (55 passed, 2 ignored)
whole binary, default threads, 4 runs at a time, one directory each 0 of 40 398 of 400

The two failed runs with this PR are older rare failures, not in the changed test:

  • mapping_state_seqlock_tracks_active_and_completed_mutations (physical_backing.rs:815), once in 300 runs from a short path.
  • gpu_pool_then_plain_cpu_view_upgrades_backing_and_keeps_mem_private (physical_backing.rs:420), once in 100 runs from cargo's output path. Line 420 is the acquire that xmem: end protection runs at private-span boundaries #662 described as failing when the CPU view lands across a 4 MiB boundary; I didn't print the addresses in this run. It poisoned POOL in that run, so the same six tests failed after it.

Also run:

  • cargo fmt --all --check and cargo +1.95.0 clippy --locked --target x86_64-pc-windows-msvc -p tuxbox-xmem --all-targets -- -D warnings: pass.
  • CI's Miri line for -p tuxbox-xmem on a local nightly (not CI's pinned one): 1 passed, 56 ignored. The test keeps its Miri ignore.

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:

python tuxbox.py status > docs/RESULTS.md
python tuxbox.py status --svg docs/progress.svg

This pull request changes no evidence JSON.

gpu_tile_hold_keeps_the_whole_private_span_mapped (brcly#660) unmaps page 1
of its four-page aperture, and its clean-up then unmapped all four in
one call. An unmap refuses a range with an unmapped page in it
(unmap_single_private_span_range returns ERROR_INVALID_ADDRESS), so
map(aperture, 4, null) returned NULL and the test failed on every run.
It panicked while holding POOL, and six more tests failed on the
poisoned lock.

The clean-up now unmaps page 0 and pages 2 and 3. The test's assertions
about the hold are unchanged and pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant