Skip to content

drm/amdgpu: fix userq eviction-fence rearm reservation

[email protected] amd-gfx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Revert "drm/amdgpu: reserve root PD fence slots for userq eviction-fence rearm"drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c+1 -50 replies
2/3Revert "drm/amdgpu: reserve eviction-fence slot at WPTR caller"drivers/gpu/drm/amd/amdgpu/mes_userqueue.c+1 -20 replies
3/3drm/amdgpu: Reserve eviction fence slot during userq rearmdrivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c+8 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/3] drm/amdgpu: fix userq eviction-fence rearm reservation

From: Vitaly Prosyak <[email protected]>

During user queue restore, the eviction-fence rearm path can attach a replacement BOOKKEEP fence after the BO reservation has been unlocked. Because dma_resv_unlock() discards unused pre-reserved capacity, a BO with no remaining fences can reach dma_resv_add_fence() with max_fences equal to zero. This triggers the dma-resv BUG_ON at dma-resv.c:319 and can crash amdgpu_userq_restore_worker.

The first two patches revert earlier caller-side reservations. The root PD reservation and the WPTR-caller reservation are no longer required once the slot is reserved at the operation that actually attaches the replacement eviction fence. Removing them avoids retaining redundant fence capacity and keeps the reservation accounting local to the rearm path.

The third patch reserves one fence slot in amdgpu_evf_mgr_rearm(), immediately before amdgpu_evf_mgr_attach_fence() is called for each locked BO. The BO is already held by the drm_exec context, so the reservation remains valid for dma_resv_add_fence(). The reservation is kept explicit in the rearm path rather than hidden in the attach helper.

The fix was validated with repeated amd_deadlock runs, including the userqueue restore reproducer.

Vitaly Prosyak (3):
Revert "drm/amdgpu: reserve root PD fence slots for userq
eviction-fence rearm"
Revert "drm/amdgpu: reserve eviction-fence slot at WPTR caller" drm/amdgpu: Reserve eviction fence slot during userq rearm

 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c          | 6 +-----
 drivers/gpu/drm/amd/amdgpu/mes_userqueue.c         | 3 +--
 3 files changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.55.0