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

Open
snoozedDev wants to merge 1 commit from upstream-pr/665 into main
snoozedDev commented 2026-12-02 22:10:35 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-12-02T22:10:35Z.


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 (a789a4e4) 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 #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.

<!-- greyfinch-sync:brcly/TuxBox:issue:5615600880 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/665). Originally posted by [snoozedDev](https://github.com/snoozedDev) on 2026-12-02T22:10:35Z. --- ## 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](../CONTRIBUTING.md#test-what-your-change-touches). - [ ] The checks relevant to this change passed - [x] 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): ```text 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: ```text 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 (a789a4e4) | 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 #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](../CONTRIBUTING.md#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: ```sh python tuxbox.py status > docs/RESULTS.md python tuxbox.py status --svg docs/progress.svg ``` This pull request changes no evidence JSON.
JeffreyBytes commented 2026-12-03 15:42:03 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-12-03T15:42:03Z.


AMD run, plus the unit tests on GE-Proton11-15. RX 6700 XT 12 GB (1002:73df), Mesa 26.3.1 RADV, GE-Proton11-15.

On the head (527e52b6), the full check had 15 passed and 2 failed. The failures are the #656 ones from the base, which is one commit behind main's fix:

Evidence: TuxBox check of 527e52b6d3a9, no uncommitted changes, GPU default adapter: 15 passed, 2 failed, 0 not run
lanes-selftest FAIL queue-page-mappings: copy ordered GPU mapping failed: 0x80004001
lanes-selftest FAIL queue-texture-boundary: map the texture tail failed: 0x80004001
lanes-selftest FAIL ray-tracing-rehydrate: map physical pages for the GPU failed: 0x80004001
buffer-remap FAIL

So I cherry-picked the commit onto 106120ca (6bfa5ac3) and ran it again. Those four passed, and the only failure was texture-publication:

Evidence: TuxBox check of 6bfa5ac350ee, no uncommitted changes, GPU default adapter: 16 passed, 1 failed, 0 not run
lanes-selftest FAIL texture-publication: signal queue failed: 0x80004005

I don't think that one is from this PR, since it only changes a unit test and lanes.exe is the same binary as on main. 106120ca passed 17 of 17 on this card earlier today, so it's intermittent. It came with a compute ring (CPC) permission fault in the kernel log, and the ring reset worked. Afterwards it passed 28 more times on 106120ca (20 alone, 8 full selftest runs), so it's rare.

The xmem unit tests under GE-Proton11-15's Wine, same commits:

main (106120ca) this PR on 106120ca
the test alone 0 of 3 pass 3 of 3
whole binary, --test-threads=1 0 of 3 (49 passed, 7 failed) 3 of 3 (56 passed, 2 ignored)

Same failure as you saw on 11-14: the panic at physical_backing.rs:248, then the six tests on the poisoned lock. So it isn't specific to 11-14's Wine.

<!-- greyfinch-sync:brcly/TuxBox:comment:7383586114 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/665#issuecomment-7383586114). Originally posted by [JeffreyBytes](https://github.com/JeffreyBytes) on 2026-12-03T15:42:03Z. --- AMD run, plus the unit tests on GE-Proton11-15. RX 6700 XT 12 GB (`1002:73df`), Mesa 26.3.1 RADV, GE-Proton11-15. On the head (527e52b6), the full check had 15 passed and 2 failed. The failures are the #656 ones from the base, which is one commit behind main's fix: ```text Evidence: TuxBox check of 527e52b6d3a9, no uncommitted changes, GPU default adapter: 15 passed, 2 failed, 0 not run lanes-selftest FAIL queue-page-mappings: copy ordered GPU mapping failed: 0x80004001 lanes-selftest FAIL queue-texture-boundary: map the texture tail failed: 0x80004001 lanes-selftest FAIL ray-tracing-rehydrate: map physical pages for the GPU failed: 0x80004001 buffer-remap FAIL ``` So I cherry-picked the commit onto `106120ca` (6bfa5ac3) and ran it again. Those four passed, and the only failure was `texture-publication`: ```text Evidence: TuxBox check of 6bfa5ac350ee, no uncommitted changes, GPU default adapter: 16 passed, 1 failed, 0 not run lanes-selftest FAIL texture-publication: signal queue failed: 0x80004005 ``` I don't think that one is from this PR, since it only changes a unit test and `lanes.exe` is the same binary as on main. `106120ca` passed 17 of 17 on this card earlier today, so it's intermittent. It came with a compute ring (CPC) permission fault in the kernel log, and the ring reset worked. Afterwards it passed 28 more times on `106120ca` (20 alone, 8 full selftest runs), so it's rare. The xmem unit tests under GE-Proton11-15's Wine, same commits: | | main (106120ca) | this PR on 106120ca | |---|---|---| | the test alone | 0 of 3 pass | 3 of 3 | | whole binary, `--test-threads=1` | 0 of 3 (49 passed, 7 failed) | 3 of 3 (56 passed, 2 ignored) | Same failure as you saw on 11-14: the panic at `physical_backing.rs:248`, then the six tests on the poisoned lock. So it isn't specific to 11-14's Wine.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/665:upstream-pr/665'
git switch 'upstream-pr/665'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/665'
git switch 'upstream-pr/665'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/665'
git switch 'upstream-pr/665'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/665'
git switch 'main'
git merge --squash 'upstream-pr/665'
git switch 'main'
git merge --ff-only 'upstream-pr/665'
git switch 'main'
git merge 'upstream-pr/665'
git push origin 'main'
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
brcly/TuxBox!665
No description provided.