Windows: #3158's host-import spans make agc_driver_dcc_keys_first_write fail on main (shared alias refused); fix branch ready #3320

Closed
opened 2026-10-11 07:25:05 +00:00 by Silverash-i8 · 1 comment
Silverash-i8 commented 2026-10-11 07:25:05 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T07:25:05Z.


#3158 (host-import spans) was merged with its original head, and on Windows it makes agc_driver_dcc_keys_first_write fail on main, as I reported on the PR before it landed. On main 010fad31, RTX 5060 Laptop, Windows 11, WinLibs GCC 15.2.0 r7, Release, 3/3:

read-write alias of shared guest memory 0x200000000+0x40000: the range is not one contiguous run of views of a section

It passes on main before #3158. On Linux the test already fails for another reason (#2767, #3179), so this didn't show there.

Cause. An import now covers the whole run of address-adjacent registered ranges. On Windows, a shared mapping in that run needs a read-write alias (GuestArenaMapAlias_nid_postfix in importAllocation), and WindowsMappings::MapAlias refuses one unless the range is a single contiguous run of views of one section at consecutive offsets. Ranges that are adjacent in guest address can still be separate views, so the span's alias is refused and the exception escapes importAllocation. Before #3158 each range was imported on its own and its alias was fine.

Fix: fix/host-import-span-windows-alias, commit aa653ec5 on main 010fad31 (nine lines added in GuestBufferMemory.cpp, one sentence in TechnicalDebt):

  • When the alias of a multi-range span is refused, the span's base goes into a new HostImports::unaliasedSpans, and importRun returns just the containing range for that span from then on, so the import, runCovers and the refresh check all agree. The import is retried for that range.
  • A refused alias for a single range still throws, as before.
  • Spans that alias fine (and all of Linux) are unchanged. A buffer that crosses two ranges of a refused span is copied, as it was before #3158; that's the sentence added to the host-import entry in TechnicalDebt.

Tested on Windows 11, RTX 5060 Laptop: agc_driver_dcc_keys_first_write passes 3/3 (fails 3/3 on main), agc_driver_graphics (with #3158's importCrossingTests / importSpanTests), agc_driver_bda_device and agc_driver_bda_span_reads pass, and all agc_* tests pass, 351/351. tools/check_conventions.py --base upstream/main passes. I haven't rerun the Arrow Lake iGPU, which is in a bad driver state after a run of watchdog resets (#2832, #3171). The existing dcc_keys_first_write case covers this on Windows, so I didn't add a new test.

cc @XairRrR

AI-assisted (Claude Code); I ran everything above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5798971349 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3320). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-11T07:25:05Z. --- #3158 (host-import spans) was merged with its original head, and on Windows it makes `agc_driver_dcc_keys_first_write` fail on `main`, as I reported on the PR before it landed. On `main` 010fad31, RTX 5060 Laptop, Windows 11, WinLibs GCC 15.2.0 r7, Release, 3/3: ``` read-write alias of shared guest memory 0x200000000+0x40000: the range is not one contiguous run of views of a section ``` It passes on `main` before #3158. On Linux the test already fails for another reason (#2767, #3179), so this didn't show there. **Cause.** An import now covers the whole run of address-adjacent registered ranges. On Windows, a shared mapping in that run needs a read-write alias (`GuestArenaMapAlias_nid_postfix` in `importAllocation`), and `WindowsMappings::MapAlias` refuses one unless the range is a single contiguous run of views of one section at consecutive offsets. Ranges that are adjacent in guest address can still be separate views, so the span's alias is refused and the exception escapes `importAllocation`. Before #3158 each range was imported on its own and its alias was fine. **Fix:** [`fix/host-import-span-windows-alias`](https://github.com/Silverash-i8/AnyPS5-fork/tree/fix/host-import-span-windows-alias), commit `aa653ec5` on `main` 010fad31 (nine lines added in `GuestBufferMemory.cpp`, one sentence in TechnicalDebt): - When the alias of a multi-range span is refused, the span's base goes into a new `HostImports::unaliasedSpans`, and `importRun` returns just the containing range for that span from then on, so the import, `runCovers` and the refresh check all agree. The import is retried for that range. - A refused alias for a single range still throws, as before. - Spans that alias fine (and all of Linux) are unchanged. A buffer that crosses two ranges of a refused span is copied, as it was before #3158; that's the sentence added to the host-import entry in TechnicalDebt. **Tested** on Windows 11, RTX 5060 Laptop: `agc_driver_dcc_keys_first_write` passes 3/3 (fails 3/3 on `main`), `agc_driver_graphics` (with #3158's `importCrossingTests` / `importSpanTests`), `agc_driver_bda_device` and `agc_driver_bda_span_reads` pass, and all `agc_*` tests pass, 351/351. `tools/check_conventions.py --base upstream/main` passes. I haven't rerun the Arrow Lake iGPU, which is in a bad driver state after a run of watchdog resets (#2832, #3171). The existing `dcc_keys_first_write` case covers this on Windows, so I didn't add a new test. cc @XairRrR AI-assisted (Claude Code); I ran everything above on my machine.
reyani-dev commented 2026-10-11 07:40:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T07:40:04Z.


Reproduced on a second machine (Windows 11, RTX 4070 Laptop, driver 616.92, main b6f649d9): agc_driver_dcc_keys_first_write fails with the same alias message. With your commit it passes 3/3, and the whole agc_*/shader/VideoOut set passes 366/366. I've carried it as #3324 with your commit unchanged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106766384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3320#issuecomment-6106766384). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T07:40:04Z. --- Reproduced on a second machine (Windows 11, RTX 4070 Laptop, driver 616.92, `main` b6f649d9): `agc_driver_dcc_keys_first_write` fails with the same alias message. With your commit it passes 3/3, and the whole `agc_*`/shader/VideoOut set passes 366/366. I've carried it as #3324 with your commit unchanged.
Sign in to join this conversation.
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
boykopovar/AnyPS5#3320
No description provided.