d3d12: default-on lazy publication causes radv/amdgpu CS rejection (-1 / EPERM) on AMD RADV #634
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 DrArroway on 2026-12-01T18:25:55Z.
Hit on AMD Radeon RX 6900 XT (1002:73bf) (Mesa
26.3.1-arch3.5RADV NAVI21,GE-Proton11-14) on currentmain(93324a2b, post-e40d8052) with PR#630(e242a160) applied so ProjectScarlett passes the slot 133768x768x6 R16_TYPELESSassert.With
TUXBOX_LAZY_PUBLICATIONleft at its new default (1aftere40d8052), ProjectScarlett dies consistently before the intro whenamdgpurejects a command stream submission with-1(-EPERM), with zero GPUVM faults in kernel logs and zero unfinished GPU commands. TogglingTUXBOX_LAZY_PUBLICATION=0on the exact same build completely eliminates the rejection and lets the game proceed into the world.Side-by-side comparison (same binary,
93324a2b+#630,TUXBOX_XMEM_PRIVATE_VIEWS=1,TUXBOX_TRACE_GPU_FAULT=1)journalctl -k)TUXBOX_TRACE_GPU_FAULT=1TUXBOX_LAZY_PUBLICATION=1(default)227.8s(10,936+frames) withradv/amdgpu: The CS has been rejected, see dmesg for more information (-1).->d3d12_command_queue_execute: Failed to submit queue(s), vr -4->VK_ERROR_DEVICE_LOST (0x887a0005)(exit code5)amdgpuGPUVM faults or ring timeoutsfence signaled UINT64_MAX (device lost); 0 unfinished commands of 45159 recordedTUXBOX_LAZY_PUBLICATION=0CS rejected (-1)errors; clears the intro cleanly into the world (413.9s,8,396presents,146,142recorded GPU commands; later hits the separate#232/#603TCPPERMISSION_FAULTS: 3GPUVM read fault)[gfxhub]PERMISSION_FAULTS: 3at413s(no-1CS rejection)31 commands started and not finished, of 146142 recorded(PS 89f6b548 MS 5f6ec27e)Relevant failure excerpt from the default (
TUXBOX_LAZY_PUBLICATION=1) run:Why this happens on Linux AMDGPU / RADV
On Linux
amdgpu, command submission (amdgpu_cs_parser_bos->amdgpu_hmm_range_get_pages) validates page table permissions for every 4 KiB page inside every referencedAMDGPU_GEM_USERPTRBO (created viaOpenExistingHeapFromAddress/OpenExistingHeapFromAddress1). If any 4 KiB page covered by a live userptr BO isPAGE_NOACCESS(PROT_NONE), the kernel rejects the CS ioctl immediately with-EPERM(-1) before the GPU ever executes a command.Three gaps in how
lazy.rscoordinates with userptr imports leavePAGE_NOACCESSpages inside liveOpenExistingHeapFromAddress*BOs:import.rs:202vs.pages.rs:85-151):lazy::reason(runtime/d3d12/src/device/placement/lazy.rs:96-109) only checksgpu_writes::any_import_overlaps(&range), which tests narrow guest buffer byte ranges (address..address + desc.Widthfromruntime/d3d12/src/device/heap/import.rs:202) against the texture's byte range — not the 64 KiB page / multi-page span extents (or roundedpages_of(&range)4 KiB pages) actually imported intoAMDGPU_GEM_USERPTRviaOpenExistingHeapFromAddress1. A deferred texture sharing a 64 KiB userptr heap with a buffer/view can leavePAGE_NOACCESSpages inside the BO.lazy::defer(lazy.rs:252-274) only checksany_import_overlapsat deferral time; nothing releases or skipslazy-heldPAGE_NOACCESSpages if a buffer or view opens a newOpenExistingHeapFromAddress*userptr import over the same 64 KiB page afterwards while the deferred texture hasn't been CPU-touched yet.PAGE_NOACCESSpage rounding (pages_of):VirtualProtect(..., PAGE_NOACCESS)inlazy.rs:260-263protects whole 4 KiB pages (pages_of), so anyOpenExistingHeapFromAddress*region touching the same 4 KiB page hitsPROT_NONE.(Related to
#625from the samee40d8052default flip, though distinct:#625isPages::releaserestoring staleVirtualProtectflags on CPU access, whereas this happens with zero CPU access faults because kernel HMM userptr validation seesPAGE_NOACCESSon a referenced BO at submit time.)Happy to help test a fix (or coordinate with
#625once it lands) on both AMD Radeon RX 6900 XT (1002:73bf) and AMD Raphael Radeon 610M iGPU (1002:164e).Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-12-01T19:14:59Z.
Same on RDNA4: RX 9070 XT (
1002:7550), Mesa 26.3.1 RADV, kernel 7.3.6, GE-Proton11-15 with its own vkd3d-proton. Build: main712fb960(aftere40d8052) + #630, plus a local log line for placed texture drops. Default settings, noTUXBOX_XMEM_PRIVATE_VIEWS,VKD3D_CONFIG=fault.VKD3D_DISABLE_EXTENSIONS=VK_EXT_device_generated_commands(log confirms it was off)All three end the same way:
followed by
VK_ERROR_DEVICE_LOST. In all three, therecorded ExecuteIndirectline is the first of the run (it is logged once), and the rejection follows within about a second.dmesgandjournalctl -khave no amdgpu or drm lines for any of the three runs: no GPUVM fault, ring timeout or reset.TUXBOX_XMEM_PRIVATE_VIEWS.With
TUXBOX_LAZY_PUBLICATION=0(same build and settings, one run): no CS rejection. The run got past the first indirect dispatch (recorded ExecuteIndirect ... kind=2is logged, then one withkind=10) and ran 807 s. As in your run, it then ended on a GPUVM TCP read fault (0x0070113B,PERMISSION_FAULTS 3). That fault is in a sparse placed-texture VA range whose previous image had been destroyed 5.3 s earlier, which is the #603 shape.Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-12-01T19:42:47Z.
Thanks
@Kayotic1337for confirming this on RDNA4 (1002:7550) too — especially ruling outVK_EXT_device_generated_commandsandTUXBOX_XMEM_PRIVATE_VIEWS!I'm claiming
#634now and working on a fix that tracks liveOpenExistingHeapFromAddress*userptr extents inlazy.rs/heap(both preventinglazy::deferfromVirtualProtect(..., PAGE_NOACCESS)-ing pages inside any live userptr BO and publishing/releasing overlapping deferred textures before a new userptr heap is opened), while leavingPages::protect/Pages::releaseuntouched so this stays orthogonal to#625.