D3D12.X: PAGES / COPY_SCRATCH lock-order deadlock: flush_zero_tiles runs a command list while holding PAGES #3069
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 ivall/xcl. Originally posted by kleborgn on 2026-11-27T19:54:19Z.
Setup: AMD Radeon RX 7900 XTX 24 GB (driver 32.0.32029.2010), Ryzen 9 7950X3D, 31 GB RAM, Windows 11 Pro 26300, Rust 1.100.0, release, DXC 1.8.2505.32. Tree:
amd-dev7c795f5+ #3024 (b7fc3b4) + #3025 (d818f46) applied as patches.XCL_NETWORK=0throughout.What happens: the title stops presenting, the
xcl-activitythread stops logging (noactivity/profile/memorylines), nothing is building, audio keeps playing. No device removal, no crash. It is a race: it hit 1 of 7 runs of the same exe.
Evidence: I attached a read-only debugger (
cdb -pv) to the stalled game process and printed every thread's stack. Threethreads are on one chain (function names only; the build is
amd-dev7c795f5+ #3024 + #3025):In the source:
COPY_SCRATCHis one globalMutex<CopyScratchCache>(list_x.rs).acquire_scratch_for_copylocks it andCopyScratchCache::acquirereleases a resource while holding it;reset_copy_scratchlocks it again.flush_zero_tiles(added by
d625b20, only onamd-dev,mainhas none) runs a command list frombefore_execute, which holdsPAGES(
Pages::flush_zero_tilesis called on&mut PagesunderPAGES.lock()).Earlier sighting: on
amd-devb5c0275a stalled run showed a different stack in the same area (flush_zero_tiles->own_work->q_execute_command_lists->present::note_execute->late_release::drain_known->vram::recycle_ready,all under
PAGES). That is not the cycle above.What I have: one occurrence, in the run described below, and the stacks above. What I do not have: a way to trigger it on
demand, a second occurrence, or a fix. I am not proposing one in this issue.
Run: the setup line above.
XCL_DIRECT_DXIL=1 XCL_PIPELINE_MAX_KB=1500 XCL_SPLIT_WAVE64=1 XCL_RT_GATE=auto XCL_DRED=1 XCL_FRAME_DUMP=45, A pressed every 6 s. The activity lines stopped at 494 s.AI use: Claude Code, Claude Sonnet 5.5 ran the runs, read the stacks and wrote this.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T02:53:46Z.
The reported two-thread cycle has a narrower entry point than
flush_zero_tilesitself. Onamd-devat7c795f5, the zero-fill list resets insidetitle_textures::own_workwhilePAGESis held. A successful PC Reset still calls the title-list reset hook, which entersCOPY_SCRATCHthroughreset_copy_scratch. In the other direction,CopyScratchCache::acquirecan drop a replaced resource while holdingCOPY_SCRATCH; its COM release can drain intovram::recycle_ready, which waits forPAGES. That matches the two stacks in this issue. #2703 bypasses the title hooks for internalExecuteCommandLists, but does not cover Reset.For this Reset edge, I suggest skipping the title-list reset hook during XCL's own work. Keep the native Reset, vtable preservation, HRESULT handling and DRED bookkeeping. The ZeroRing list records native buffer copies and barriers; it has no title-list scratch or binding state to clear.
Candidate one-line guard
A focused regression can use the existing fake adopted-list pattern in
real::queue_testsand the test-onlydispatch_chain::seed_shared_for_test/has_shared_for_testhelpers: seed state for the fake list, call successful native Reset insideown_work, and verify native Reset ran while the title-list reset hook did not clear that state. A normal successful Reset should clear it; a failed Reset should leave it. A repeated run of the reported AMD setup would then check the actual hang.This guard addresses the observed
PAGES -> COPY_SCRATCHReset edge. COM releases elsewhere underCOPY_SCRATCHand other internal calls made while holdingPAGESstill need a separate lock-order audit. I checked the source path; I have not run this candidate or a title test.AI use: Codex (GPT-6.2 Sol) traced the path and wrote this note; Codex (GPT-6.2 Astra) independently checked the lock and lifecycle edges.