amdgpu_dma_buf_move_notify() touches the page tables without first
calling amdgpu_vm_ready(). When a process is SIGKILLed, its VM entities
are stopped. Teardown of an imported dma-buf then tries to clear PTEs by
submitting to one of those stopped entities. That eventually hangs the
task.

Commit aa5fc4362fac ("drm/amdgpu: fix task hang from failed job
submission during process kill") added the stopped entity check in
amdgpu_vm_ready() and used it in amdgpu_cs_vm_handling(). That did not
cover a call in amdgpu_dma_buf_move_notify(), what was already mentioned
in:
https://lists.freedesktop.org/archives/amd-gfx/2025-October/133076.html

Tested by SIGKILLing a GPU workload holding imported dma-bufs. Without
the patch "Trying to push to a killed entity" errors are logged, then a
task hangs. With the patch there are no hung tasks. This was tested on a
6.18 kernel.

Signed-off-by: Dariusz Marcinkiewicz <[email protected]>
Assisted-by: LLM
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 9c80eef79e32..ee473a888331 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -481,6 +481,11 @@ amdgpu_dma_buf_move_notify(struct dma_buf_attachment 
*attach)
                                continue;
                }
 
+               if (!amdgpu_vm_ready(vm)) {
+                       dma_resv_unlock(resv);
+                       continue;
+               }
+
                /* Reserve fences for two SDMA page table updates */
                r = dma_resv_reserve_fences(resv, 2);
                if (!r)
-- 
2.55.0.1082.g2b9226bbc0-goog

Reply via email to