xmem: back physical pages with their section from the start #464
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/464"
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-29T10:51:34Z.
Summary
Fixes #456.
Problem. Every mapping of a physical page is the same memory, and a title reads and writes through whichever mapping it likes. With private backing, a second mapping stays inaccessible until its first access promotes it. Promotion is refused (
ERROR_BUSY) while a host import holds the page, so that first access kills the title. In ProjectScarlett this ended every run about 100-170 frames into the first story mission.Change. Newly mapped pages go through their section (
map_shared_page/map_contiguous). A second mapping then needs no promotion, and a hold can't block it.TUXBOX_XMEM_PRIVATE_VIEWS=1restores private backing.Two
CopyPageMappingsXfixes that follow from it:DeferredKind::SectionPlaceholder). A later copy that maps a GPU alias over that address failed withERROR_INVALID_ADDRESS, and the copy queue dropped every later batch (copy queue rejected a guest command-list batch (0x800701e7)). The queue drains its GPU work before the copy and retires the overlapping imports after it, so the copy now releases that view first.Trade-off. Section-backed pages have no write watch (
tracking.rs), so the d3d12 provider digests their textures instead. With #439, the run below kept that cost low.Tested
xmem): only the type check and ProjectScarlett runs (below). Thexmemsuite hasn't been run.tests/physical_backing.rsinstead:backing_mode);GPU, driver and backend: RX 9060 XT, RADV (Mesa), GE-Proton11-14, vkd3d-proton.
Commands run and their results:
The unit tests were compiled but not run: no
link.exeon this host.ProjectScarlett:
mainplus local patches, private backing. The run died at the mission start onalias ... write fault not promoted (error 170), or stalled on labels that the CPU never saw written.Checks
No evidence JSON changed.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T12:30:09Z.
NVIDIA evidence (RTX 5090, 620.70.10, GE-Proton11-14), one run each of the same build (
maind2eb99ed+ #462, #463, #455, #461, #441 and diagnostics), same warm caches:TUXBOX_XMEM_PRIVATE_VIEWS=1XCRDAPI.dll(worker thread)The access violation came in the private run only, which fits the "held page not promoted" fault #456 describes, but I didn't decode the address, so it is consistent with it, not proven. Two runs can't say more.
On cost: placed-texture pages now show as section-backed (median 8 GiB/s, up to 41 GiB/s, of section texture memory in the watch line, against 0 with private views). That didn't show up as a clear difference in frames per 20 s between the two runs (both fell to a few frames per 20 s within about 60 s of the story), but I'd not call it measured: the runs differ in what they reached.