From acbfcb4d363ec2354aa0e140d9ee3b3992566928 Mon Sep 17 00:00:00 2001 From: Yogesh Mohan Marimuthu Date: Wed, 18 Dec 2024 16:29:47 +0530 Subject: [PATCH] winsys/amdgpu: ring doorbell before calling userq_signal ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The signal ioctl should only be called after guaranteeing that the hardware started working on the submissions and that is only after doorbell is ringed. Otherwise it can in theory happen that the application creates the fence and is then interrupted before ringing the doorbell. That can result in a GPU reset because the fence times out. Suggested-by: Christian König Reviewed-by: Marek Olšák Part-of: --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp index 97cd68cf759..95c233d8519 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp @@ -1548,9 +1548,8 @@ static int amdgpu_cs_submit_ib_userq(struct amdgpu_userq *userq, .num_bo_write_handles = num_shared_buf_write, }; + userq->doorbell_bo_map[AMDGPU_USERQ_DOORBELL_INDEX] = *userq->wptr_bo_map; r = ac_drm_userq_signal(aws->dev, &userq_signal_data); - if (!r) - userq->doorbell_bo_map[AMDGPU_USERQ_DOORBELL_INDEX] = *userq->wptr_bo_map; *seq_no = userq->user_fence_seq_num; simple_mtx_unlock(&userq->lock);