drm/amdgpu: check amdgpu_vm_ready() in dma-buf move notify
Subsystems (2)
PATCH RESEND 1/1 drm/amdgpu: check amdgpu_vm_ready() in dma-buf move notify
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +5 -0
@@ -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)
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
Quoted 14 lines · Dariusz Marcinkiewicz
amdgpu_dma_buf_move_notify()touches the page tables without first callingamdgpu_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 inamdgpu_vm_ready()and used it inamdgpu_cs_vm_handling(). That did not cover a call inamdgpu_dma_buf_move_notify(), what was already mentioned in:
https://lists.freedesktop.org/archives/amd-gfx/2025-October/133076.html
Quoted 7 lines
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
Looks good to me. Applied!
Thanks,
Alex
Quoted 23 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +5
-1@@ -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