Skip to contentSkip to conversation

drm/amdgpu: Fix display freezing issue when resizing apps

PATCH In review Arvind Yadav 3 participants 3 messages Mar 18, 2025 – Mar 19, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix display freezing issue when resizing apps

The display is freezing because the amdgpu_userq_wait_ioctl() is waiting for a non-user queue fence(specifically, the PT update fence).

RootCause:
The resume_work is initiated by both amdgpu_userq_suspend and amdgpu_userqueue_ensure_ev_fence at same time. The amdgpu_userq_suspend signals a dma-fence and subsequently triggers the resume_work, which is intended to replace the existing fence by creating new dma-fence. However, following this, the amdgpu_userqueue_ensure_ev_fence schedules another resume_work that generates a new dma-fence, thereby replacing the one created by amdgpu_userq_suspend. Consequently, the original fence will never be signaled.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c +3 -0
index 167951aee502..0075469550b0 100644
@@ -52,6 +52,9 @@ amdgpu_eviction_fence_replace_fence(struct amdgpu_eviction_fence_mgr *evf_mgr,
 	unsigned long index;
 	int ret;
 
+	if (evf_mgr->ev_fence &&
+	    !dma_fence_is_signaled(&evf_mgr->ev_fence->base))
+		return 0;
 	/*
 	 * Steps to replace eviction fence:
 	 * * lock all objects in exec (caller)
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Regards
Shashank
________________________________
From: Yadav, Arvind
Sent: Tuesday, March 18, 2025 3:54 PM
To: Koenig, Christian; Deucher, Alexander; Khatri, Sunil; Sharma, Shashank
Cc: [email protected]; Yadav, Arvind; Koenig, Christian; Yadav, Arvind
Subject: [PATCH] drm/amdgpu: Fix display freezing issue when resizing apps

The display is freezing because the amdgpu_userq_wait_ioctl() is waiting for a non-user queue fence(specifically, the PT update fence).

RootCause:
The resume_work is initiated by both amdgpu_userq_suspend and amdgpu_userqueue_ensure_ev_fence at same time. The amdgpu_userq_suspend signals a dma-fence and subsequently triggers the resume_work, which is intended to replace the existing fence by creating new dma-fence. However, following this, the amdgpu_userqueue_ensure_ev_fence schedules another resume_work that generates a new dma-fence, thereby replacing the one created by amdgpu_userq_suspend. Consequently, the original fence will never be signaled.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c +3 -0
index 167951aee502..0075469550b0 100644
@@ -52,6 +52,9 @@ amdgpu_eviction_fence_replace_fence(struct amdgpu_eviction_fence_mgr *evf_mgr,
         unsigned long index;
         int ret;
 
+       if (evf_mgr->ev_fence &&
+           !dma_fence_is_signaled(&evf_mgr->ev_fence->base))
+               return 0;
         /*
          * Steps to replace eviction fence:
          * * lock all objects in exec (caller)

--
2.34.1

maintainer
#2 lore raw
In reply to Arvind Yadav

Am 18.03.25 um 15:54 schrieb Arvind Yadav:

Quoted 29 lines

The display is freezing because the amdgpu_userq_wait_ioctl() is waiting for a non-user queue fence(specifically, the PT update fence).

RootCause:
The resume_work is initiated by both amdgpu_userq_suspend and amdgpu_userqueue_ensure_ev_fence at same time. The amdgpu_userq_suspend signals a dma-fence and subsequently triggers the resume_work, which is intended to replace the existing fence by creating new dma-fence. However, following this, the amdgpu_userqueue_ensure_ev_fence schedules another resume_work that generates a new dma-fence, thereby replacing the one created by amdgpu_userq_suspend. Consequently, the original fence will never be signaled.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Shashank Sharma <[email protected]>
Cc Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c +0 -0
index 167951aee502..0075469550b0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c amdgpu_eviction_fence_replace_fence(struct amdgpu_eviction_fence_mgr *evf_mgr, · line 57

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c +3 -0
@@ -52,6 +52,9 @@ amdgpu_eviction_fence_replace_fence(struct amdgpu_eviction_fence_mgr *evf_mgr,
 	unsigned long index;
 	int ret;
 
+	if (evf_mgr->ev_fence &&
+	    !dma_fence_is_signaled(&evf_mgr->ev_fence->base))
+		return 0;

We might want to also have a flush_work(&evf_mgr->suspend_work) before that test as well to make sure an in flight signaling has finished as well.

With that done Reviewed-by: Christian König <[email protected]>.

Thanks,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c +0 -0
 	/*
 	 * Steps to replace eviction fence:
 	 * * lock all objects in exec (caller)