xmem: map_alias of no pages changes nothing, next to a reservation shown whole too #99

Closed
ySKELLETONX wants to merge 1 commit from upstream-pr/99 into main
ySKELLETONX commented 2026-11-25 14:03:07 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by ySKELLETONX on 2026-11-25T14:03:07Z.


Why

map_alias(to, from, 0) should change nothing, but it returns false when to is the first byte past one reservation and the next reservation is shown whole. in_whole(to, 0) is true for an empty range at either end of a whole range (at <= to && to + 0 <= at + n).

mapping_no_pages_changes_nothing calls it at a + 2 * PAGE, right past its own 2-page reservation. With #93 applied, its new a_large_run_of_pages_is_shown_whole leaves a 65-page reservation shown whole. When the two tests run in parallel and that reservation is placed directly after the small one, the test fails at the assert!(map_alias(at as u64, a as u64, 0)) line.

What

map_alias returns true for len == 0 before it takes the lock. Nothing else changes.

Testing

RX 7600 XT 16 GB (RDNA3), Windows 11 Pro build 26300, Rust 1.98.1.

  • #93 (68d437d) alone: cargo test -p victory-hle --lib xmem failed in 9 of 40 runs, always mapping_no_pages_changes_nothing. With --test-threads=1, or with --skip a_large_run_of_pages_is_shown_whole: 0 of 40.
  • #93 + this change: 0 of 60 parallel runs. Full crate: 103 passed, 0 failed, 1 ignored.
  • On main alone, this moves mapping_no_pages_changes_nothing past its map_alias check (the failure at xmem.rs:1386 in #91). It still fails further on (4096 vs 8192), and #93 fixes that part. The other 4 xmem failures are unchanged here.

Related: #93, #91, #8.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6606263073 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/99). Originally posted by [ySKELLETONX](https://github.com/ySKELLETONX) on 2026-11-25T14:03:07Z. --- ## Why `map_alias(to, from, 0)` should change nothing, but it returns false when `to` is the first byte past one reservation and the next reservation is shown whole. `in_whole(to, 0)` is true for an empty range at either end of a whole range (`at <= to && to + 0 <= at + n`). `mapping_no_pages_changes_nothing` calls it at `a + 2 * PAGE`, right past its own 2-page reservation. With #93 applied, its new `a_large_run_of_pages_is_shown_whole` leaves a 65-page reservation shown whole. When the two tests run in parallel and that reservation is placed directly after the small one, the test fails at the `assert!(map_alias(at as u64, a as u64, 0))` line. ## What `map_alias` returns true for `len == 0` before it takes the lock. Nothing else changes. ## Testing RX 7600 XT 16 GB (RDNA3), Windows 11 Pro build 26300, Rust 1.98.1. - #93 (`68d437d`) alone: `cargo test -p victory-hle --lib xmem` failed in **9 of 40** runs, always `mapping_no_pages_changes_nothing`. With `--test-threads=1`, or with `--skip a_large_run_of_pages_is_shown_whole`: 0 of 40. - #93 + this change: **0 of 60** parallel runs. Full crate: 103 passed, 0 failed, 1 ignored. - On `main` alone, this moves `mapping_no_pages_changes_nothing` past its `map_alias` check (the failure at xmem.rs:1386 in #91). It still fails further on (`4096` vs `8192`), and #93 fixes that part. The other 4 xmem failures are unchanged here. Related: #93, #91, #8.
ySKELLETONX commented 2026-11-26 15:10:39 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by ySKELLETONX on 2026-11-26T15:10:39Z.


Closing this: #14 and #16 both carry the same change (map_alias returns true for len == 0 before the in_whole check) together with the fix for the five xmem failures, so whichever of them is merged covers it, and this would only conflict. Checked here on main 4f62c2a: each of them passes all xmem tests (#16 in 50 of 50 runs).

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7195893142 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/99#issuecomment-7195893142). Originally posted by [ySKELLETONX](https://github.com/ySKELLETONX) on 2026-11-26T15:10:39Z. --- Closing this: #14 and #16 both carry the same change (`map_alias` returns `true` for `len == 0` before the `in_whole` check) together with the fix for the five `xmem` failures, so whichever of them is merged covers it, and this would only conflict. Checked here on `main` 4f62c2a: each of them passes all `xmem` tests (#16 in 50 of 50 runs).

Pull request closed

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
Belobug/VIctory-Belobug-AMD!99
No description provided.