Skip to contentSkip to conversation

drm/amdgpu: Fix vce work queue was not cancelled when suspend

PATCH In review Rex Zhu 3 participants 3 messages Sep 27, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix vce work queue was not cancelled when suspend

The vce cancel_delayed_work_sync never be called. driver call the function in error path.

This caused the A+A suspend hang when runtime pm enebled. As we will visit the smu in the idle queue. this will cause smu hang because the dgpu has been suspend, and the dgpu also will be waked up. As the smu has been hang, so the dgpu resume will failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 -1
index 0cc5190..5f3f540 100644
@@ -258,6 +258,8 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)
 {
 	int i;
 
+	cancel_delayed_work_sync(&adev->vce.idle_work);
+
 	if (adev->vce.vcpu_bo == NULL)
 		return 0;
 
@@ -268,7 +270,6 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)
 	if (i == AMDGPU_MAX_VCE_HANDLES)
 		return 0;
 
-	cancel_delayed_work_sync(&adev->vce.idle_work);
 	/* TODO: suspending running encoding sessions isn't supported */
 	return -EINVAL;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
index a73674f..fb7df63 100644
@@ -162,11 +162,11 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)
 	unsigned size;
 	void *ptr;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	if (adev->vcn.vcpu_bo == NULL)
 		return 0;
 
-	cancel_delayed_work_sync(&adev->vcn.idle_work);
-
 	size = amdgpu_bo_size(adev->vcn.vcpu_bo);
 	ptr = adev->vcn.cpu_addr;
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1538052519-11254-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 27.09.2018 um 14:48 schrieb Rex Zhu:

Quoted 10 lines

The vce cancel_delayed_work_sync never be called. driver call the function in error path.

This caused the A+A suspend hang when runtime pm enebled. As we will visit the smu in the idle queue. this will cause smu hang because the dgpu has been suspend, and the dgpu also will be waked up. As the smu has been hang, so the dgpu resume will failed.

Good catch! Patch is Reviewed-by: Christian König <[email protected]>.

Quoted 34 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
  2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 -1
index 0cc5190..5f3f540 100644
@@ -258,6 +258,8 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)
  {
  	int i;
 
+	cancel_delayed_work_sync(&adev->vce.idle_work);
+
  	if (adev->vce.vcpu_bo == NULL)
  		return 0;
 
@@ -268,7 +270,6 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)
  	if (i == AMDGPU_MAX_VCE_HANDLES)
  		return 0;
 
-	cancel_delayed_work_sync(&adev->vce.idle_work);
  	/* TODO: suspending running encoding sessions isn't supported */
  	return -EINVAL;
  }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -0
index a73674f..fb7df63 100644
@@ -162,11 +162,11 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)
  	unsigned size;
  	void *ptr;
 

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_suspend(struct amdgpu_device *adev) · line 172

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
  	if (adev->vcn.vcpu_bo == NULL)
  		return 0;
 
-	cancel_delayed_work_sync(&adev->vcn.idle_work);
-
  	size = amdgpu_bo_size(adev->vcn.vcpu_bo);
  	ptr = adev->vcn.cpu_addr;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Feifei Xu
#3 lore raw
In reply to a message not in the archive

Thanks

Regards,
Feifei

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月27日 20:49
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix vce work queue was not cancelled when suspend

The vce cancel_delayed_work_sync never be called. driver call the function in error path.

This caused the A+A suspend hang when runtime pm enebled.
As we will visit the smu in the idle queue. this will cause smu hang because the dgpu has been suspend, and the dgpu also will be waked up. As the smu has been hang, so the dgpu resume will failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 ++-  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 -1
index 0cc5190..5f3f540 100644
@@ -258,6 +258,8 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)  {
 	int i;
 
+	cancel_delayed_work_sync(&adev->vce.idle_work);
+
 	if (adev->vce.vcpu_bo == NULL)
 		return 0;
 
@@ -268,7 +270,6 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)
 	if (i == AMDGPU_MAX_VCE_HANDLES)
 		return 0;
 
-	cancel_delayed_work_sync(&adev->vce.idle_work);
 	/* TODO: suspending running encoding sessions isn't supported */
 	return -EINVAL;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
index a73674f..fb7df63 100644
@@ -162,11 +162,11 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)
 	unsigned size;
 	void *ptr;
 
+	cancel_delayed_work_sync(&adev->vcn.idle_work);
+
 	if (adev->vcn.vcpu_bo == NULL)
 		return 0;
 
-	cancel_delayed_work_sync(&adev->vcn.idle_work);
-
 	size = amdgpu_bo_size(adev->vcn.vcpu_bo);
 	ptr = adev->vcn.cpu_addr;
 

--
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx