diff options
| author | Zhu Lingshan <lingshan.zhu@amd.com> | 2026-08-14 16:37:01 +0800 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-08-19 10:12:12 -0400 |
| commit | 5c082f4cd17601e2357c1c4a686a85a53411c3d0 (patch) | |
| tree | b2d8c7848c5b48f001d76938d1ce384358ada5c3 /scripts/const_structs.checkpatch | |
| parent | 8fce9b0f93e222451d3f586c129c7b9f53a53fd2 (diff) | |
| download | linux-5c082f4cd17601e2357c1c4a686a85a53411c3d0.tar.gz linux-5c082f4cd17601e2357c1c4a686a85a53411c3d0.zip | |
drm/amdgpu: fix hang and race in userq destroy
When a queue is hung, the hang_detect_work is the
only way to recover it. However in amdgpu_userq_destroy(),
the hang_detect_work is cancelled too early,
resulting in amdgpu_userq_wait_for_last_fence()
may never return, leaving an uninterruptible dma_fence_wait()
hang there.
To fix this problem, this commit moves the cancelling of
hang_detect_work after amdgpu_userq_wait_for_last_fence(), and it has
to be before the unmap helper, because hang_detect_work resets the
queue, so it races with amdgpu_userq_unmap_helper() for MES operations
and queue state.
This commit splits amdgpu_userq_cleanup() into two parts:
1) amdgpu_userq_detach_doorbell(), which detaches the queue from
userq_doorbell_xa. This has to be called before the cancel, otherwise
the IRQ handlers (for example amdgpu_userq_process_fence_irq)
can re-schedule the hang_detect_work and the cancel is not final.
2) amdgpu_userq_fence_driver_free(), this has to be called after the
unmap helper, because it can release the seq64 slot that the GPU
writes fence values to.
Only one cancel_delayed_work_sync(&queue->hang_detect_work) is needed,
so other redundancies are removed.
Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'scripts/const_structs.checkpatch')
0 files changed, 0 insertions, 0 deletions
