[PATCH 3/6] drm/amdgpu: screen freeze and userq driver crash

Arunpravin Paneer Selvam Arunpravin.PaneerSelvam at amd.com
Fri Aug 30 18:43:19 UTC 2024


Screen freeze and userq fence driver crash while playing Xonotic

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index d2e1d0d0f29f..8a3b5374cc1a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -187,6 +187,7 @@ int amdgpu_userq_fence_create(struct amdgpu_usermode_queue *userq,
 	struct amdgpu_userq_fence_driver *fence_drv;
 	struct amdgpu_userq_fence *userq_fence;
 	struct dma_fence *fence;
+	unsigned long flags;
 
 	fence_drv = userq->fence_drv;
 	if (!fence_drv)
@@ -230,14 +231,15 @@ int amdgpu_userq_fence_create(struct amdgpu_usermode_queue *userq,
 		}
 	}
 
-	spin_lock(&fence_drv->fence_list_lock);
 	/* Check if hardware has already processed the job */
-	if (!dma_fence_is_signaled(fence))
+	if (!dma_fence_is_signaled(fence)) {
+		spin_lock_irqsave(&fence_drv->fence_list_lock, flags);
 		list_add_tail(&userq_fence->link, &fence_drv->fences);
-	else
-		dma_fence_put(fence);
 
-	spin_unlock(&fence_drv->fence_list_lock);
+		spin_unlock_irqrestore(&fence_drv->fence_list_lock, flags);
+	} else {
+		dma_fence_put(fence);
+	}
 
 	*f = fence;
 
-- 
2.34.1



More information about the amd-gfx mailing list