Hi Christian, Alex and Cascardo, This v2 replaces my posted interrupt-flag-only RFC. I first bracket page-table allocation with commit/prepare, then move the CPU KERNEL dependency wait into prepare, as requested. My author and sign-off name is corrected to Zihao Mu.
The six patches are based on drm-amdgpu-next a6836fcbb5b2: 1. Handle missing/empty SDMA jobs and consume each job once. 2. Track internal SDMA completion independently of the public output fence, including immediate submissions, IB rollover and nested clears. 3. Finalize partial range updates on error, preserving the first error and using the preceding internal completion for TLB ordering. 4. Unwind failed page-table initialization through the VM entry teardown; finish the clear's current work before returning its original error. 5. Commit before allocation and re-prepare after clearing the new table, preserving the original sync even when the old phase had an empty job. 6. Wait for shared root KERNEL dependencies in CPU prepare, including NULL-sync calls; remove the reservation wait from CPU update. Patches 1 and 3 adapt Cascardo's earlier cleanup proposals, retaining his authorship and original sign-off. I am not claiming that work as new. The internal completion prerequisite comes before partial-error range finalization, so an earlier submitted IB is already tracked if allocating its replacement fails. A clear completion is also retained if the outer prepare fails. The public !immediate output condition and DONT_PIPELINE policy are unchanged. PDE error handling is outside this series. The KERNEL wait keeps its original interruptible policy. Interruption now fails prepare before that phase starts writing; previous phases have been committed and receive partial-range finalization. Allocation drops the eviction lock and can introduce new move dependencies, which is why the next phase must prepare again. The CPU write/flags/commit tail is unchanged. This does not reintroduce the old PTE-walker error-propagation proposal, mapping retention or the independent no-KERNEL scan fastpath. SDMA allocations can still fail. This is not a complete conversion of all mapping/unmapping operations to a no-fail interface. Local validation: - All six intermediate source states compiled amdgpu_vm.o, amdgpu_vm_pt.o, amdgpu_vm_sdma.o and amdgpu_vm_cpu.o with GCC 13.3.0 and CONFIG_DRM_AMDGPU=m. - Each intermediate state passed its applicable extracted-function checks. The final state passed 106 successful range/backend cases, 149 failure cases and 2 successful PDE cases. SDMA fences remain pending at submit; the native TLB callback and worker bodies run with both worker-first and GPU-first simulated completion schedules. - Two older source states reproduce the missing completion dependency; four deliberate mutations detect missing nested completion, prepare, sync and allocation boundaries. - 960 CPU phase/parameter cases preserve PTE values/flags, with two KERNEL-wait interruption cases, one explicit-sync interruption case and two detected missing-wait controls. A 64-batch single-phase model calls the reservation wait once instead of 64 times; this is a call count, not a timing result. ASan/UBSan reported no errors. The GPU, scheduler, fence primitives, BO/TTM lifetime and PTE/PDE walker orchestration in those checks are simulated. They do not prove kernel concurrency or hardware ordering. No full module link, driver load, live fault injection or hardware A/B has been done. This does not establish a fix for the original multi-second GPU queue stalls. Please review the phase boundaries and internal completion ownership, especially immediate SDMA submissions and errors after a nested clear. Changes from the posted RFC: - Establish allocation boundaries before moving the CPU wait. - Remove the wait from update instead of making that wait uninterruptible. - Add narrowly scoped job, completion and initialization prerequisites. - Correct my full author/sign-off name and retain prior-work attribution. Earlier cleanup proposals: https://lore.kernel.org/amd-gfx/[email protected]/ https://lore.kernel.org/amd-gfx/[email protected]/ Latest review: https://lore.kernel.org/r/[email protected] Regards, Zihao base-commit: a6836fcbb5b22968019256025321d655b78bc49c -- 2.43.0
