xmem: a secondary alias whose backing a host import holds can never be promoted, and the first CPU access through it kills the title #456
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Jerkin42 on 2026-11-29T07:54:18Z.
Seen on: RX 9060 XT (RADV), ProjectScarlett 1.0.2.1,
main28717263plus #389, #390, #436 (and later #442, #443, #445, #448), GE-Proton11-14, with and without our local userptr shim.What happens. With #409 and #428 merged, the first story mission gets past the BLAS faults from #403. About 100-170 game frames in, the title dies on an unhandled access violation in title memory:
The writer was first our storage DLL (a decoded read copied into its destination). After we routed those writes around it (below), the title's own code hit the same thing on a read (
game+0x465C80,write=0).Why, as far as we can tell.
physical_pages/private_views.rs: the second VA mapping of a physical page is a secondary alias. It stays inaccessible andsecondary_alias_vehpromotes it on the first fault (promote_faulting_alias). That returnsERROR_BUSYwhen the page's private span has a hold (has_hold) or a deferred unmap. The VEH then returnsEXCEPTION_CONTINUE_SEARCHand the title dies.A host import (
TuxBoxAcquirePhysicalBacking*fromd3d12/src/device/heap/backing.rs) keeps its hold for as long as the imported heap lives. So an alias registered before the import is never promoted while the heap is alive. We added a local log to the VEH that retriesERROR_BUSYfor 2 s:What we tried locally.
xcrdapiwrites decoded reads throughTuxBoxAcquirePhysicalAccessruns instead of storing to the destination VA. This removed every storage-thread fault (32k+ reads in one run).acquire_runs(import = true), first promote every secondary alias of the range's tokens. Many were refused because an earlier import already held the span (promoted 3 secondary alias(es) first, 36 refused). Worse, moving the backing under live imports made root-view imports fail: 36command list failed 0x80004001inroot_buffer, so labels were never written and the title stopped. We dropped this one.Question. On the console every mapping of a physical page is the same memory, and the title reads and writes through whichever VA it likes, with no first-touch step.
PageBacking::SharedSectionalready gives that. Would it work to keep XMem physical pages section-backed from the start (perhaps only pages a title maps at a second VA, or every page when a switch is set), so that an alias never needs promotion and a hold never blocks it? Or is there a reason private backing must come first (host import of section memory, map count)?vm.max_map_counthere is 1048576. Happy to test a branch; we can reproduce in about 15 minutes.Logs and the local patches (no game data) are available on request.
Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-29T08:35:45Z.
A local experiment answers part of the question. It's a switch that sends every newly mapped page through
map_shared_page/map_contiguous(section-backed from the start) instead of the private paths.tracking.rssays), so the d3d12 provider re-checks every placed texture. Frame time went from normal to 10-30 s per frame right after the mission start, and the title's own watchdog ended the run.So the trade-off is coherence vs write watch. Two directions we can see:
held_private_arena_promotion_notifies_invalidation_and_keeps_hold_livedoes for arenas.We'll try 2 on the d3d12 side next. Which of these fits xmem better for you?