Skip to contentSkip to conversation

drm/amdgpu: fix Polaris12 uvd crash on driver unload

PATCH In review Evan Quan 2 participants 5 messages Oct 11, 2021 – Oct 18, 2021

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix Polaris12 uvd crash on driver unload

This is a supplement for the change below:
cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

Change-Id Iedc25e2f572f04772511d56781b01b481e22fd00
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +13 -11
index d5d023a24269..2d558c2f417d 100644
@@ -534,6 +534,19 @@ static int uvd_v6_0_hw_fini(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	cancel_delayed_work_sync(&adev->uvd.idle_work);
+
+	if (RREG32(mmUVD_STATUS) != 0)
+		uvd_v6_0_stop(adev);
+
+	return 0;
+}
+
+static int uvd_v6_0_suspend(void *handle)
+{
+	int r;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
 	/*
 	 * Proper cleanups before halting the HW engine:
 	 *   - cancel the delayed idle work
@@ -558,17 +571,6 @@ static int uvd_v6_0_hw_fini(void *handle)
 						       AMD_CG_STATE_GATE);
 	}
 
-	if (RREG32(mmUVD_STATUS) != 0)
-		uvd_v6_0_stop(adev);
-
-	return 0;
-}
-
-static int uvd_v6_0_suspend(void *handle)
-{
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
 	r = uvd_v6_0_hw_fini(adev);
 	if (r)
 		return r;
Signature · 1 line
2.29.0
author
#1 lore raw

[AMD Official Use Only]

Ping..

Quoted 60 lines

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, October 11, 2021 4:28 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amdgpu: fix Polaris12 uvd crash on driver unload

This is a supplement for the change below:
cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

Change-Id Iedc25e2f572f04772511d56781b01b481e22fd00
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +12 -11
index d5d023a24269..2d558c2f417d 100644
@@ -534,6 +534,19 @@ static int uvd_v6_0_hw_fini(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	cancel_delayed_work_sync(&adev->uvd.idle_work);
+
+	if (RREG32(mmUVD_STATUS) != 0)
+		uvd_v6_0_stop(adev);
+
+	return 0;
+}
+
+static int uvd_v6_0_suspend(void *handle) {
+	int r;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
 	/*
 	 * Proper cleanups before halting the HW engine:
 	 *   - cancel the delayed idle work
@@ -558,17 +571,6 @@ static int uvd_v6_0_hw_fini(void *handle)
 						       AMD_CG_STATE_GATE);
 	}
 
-	if (RREG32(mmUVD_STATUS) != 0)
-		uvd_v6_0_stop(adev);
-
-	return 0;
-}
-
-static int uvd_v6_0_suspend(void *handle) -{
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
 	r = uvd_v6_0_hw_fini(adev);
 	if (r)
 		return r;
--

2.29.0

#2 lore raw
Quoted 30 lines · Evan

[AMD Official Use Only]

Ping..

Quoted 26 lines

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, October 11, 2021 4:28 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amdgpu: fix Polaris12 uvd crash on driver unload

This is a supplement for the change below:
cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

Change-Id Iedc25e2f572f04772511d56781b01b481e22fd00
---
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 +++++++++++++-----------
  1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
index d5d023a24269..2d558c2f417d 100644
@@ -534,6 +534,19 @@ static int uvd_v6_0_hw_fini(void *handle)  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_hw_fini(void *handle) { · line 537

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
+	cancel_delayed_work_sync(&adev->uvd.idle_work);
+

To solve Boris' issue, this patch should be modified such that DPM disable done by the idle job shouldn't be executed during hw_fini. Preventing powergate during suspend is not needed.

Thanks,
Lijo

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +10 -11
+	if (RREG32(mmUVD_STATUS) != 0)
+		uvd_v6_0_stop(adev);
+
+	return 0;
+}
+
+static int uvd_v6_0_suspend(void *handle) {
+	int r;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
  	/*
  	 * Proper cleanups before halting the HW engine:
  	 *   - cancel the delayed idle work
@@ -558,17 +571,6 @@ static int uvd_v6_0_hw_fini(void *handle)
  						       AMD_CG_STATE_GATE);
  	}
 
-	if (RREG32(mmUVD_STATUS) != 0)
-		uvd_v6_0_stop(adev);
-
-	return 0;
-}
-
-static int uvd_v6_0_suspend(void *handle) -{
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
  	r = uvd_v6_0_hw_fini(adev);
  	if (r)
  		return r;
--

2.29.0

author
#3 lore raw

[AMD Official Use Only]

Quoted 42 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, October 18, 2021 4:05 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix Polaris12 uvd crash on driver unload

Quoted 10 lines · Evan

[AMD Official Use Only]

Ping..

Quoted 6 lines

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, October 11, 2021 4:28 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Quan, Evan

<[email protected]>

Quoted 9 lines
Quoted 9 lines

Subject: [PATCH] drm/amdgpu: fix Polaris12 uvd crash on driver unload

This is a supplement for the change below:
cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

Change-Id Iedc25e2f572f04772511d56781b01b481e22fd00
---
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 +++++++++++++--------

---

Quoted 10 lines
Quoted 10 lines
  1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
index d5d023a24269..2d558c2f417d 100644
@@ -534,6 +534,19 @@ static int uvd_v6_0_hw_fini(void *handle)  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
Quoted 6 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_hw_fini(void *handle) { · line 537

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
+	cancel_delayed_work_sync(&adev->uvd.idle_work);
+

To solve Boris' issue, this patch should be modified such that DPM disable done by the idle job shouldn't be executed during hw_fini. Preventing powergate during suspend is not needed.

[Quan, Evan] This is not intended to fix Boris' issue. It just adds the missing in previous Andrey's fix cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

BR
Evan

Quoted 36 lines

Thanks,
Lijo

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +10 -11
+	if (RREG32(mmUVD_STATUS) != 0)
+		uvd_v6_0_stop(adev);
+
+	return 0;
+}
+
+static int uvd_v6_0_suspend(void *handle) {
+	int r;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
  	/*
  	 * Proper cleanups before halting the HW engine:
  	 *   - cancel the delayed idle work
@@ -558,17 +571,6 @@ static int uvd_v6_0_hw_fini(void *handle)
  						       AMD_CG_STATE_GATE);
  	}
 
-	if (RREG32(mmUVD_STATUS) != 0)
-		uvd_v6_0_stop(adev);
-
-	return 0;
-}
-
-static int uvd_v6_0_suspend(void *handle) -{
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
  	r = uvd_v6_0_hw_fini(adev);
  	if (r)
  		return r;
--

2.29.0

#4 lore raw
Quoted 46 lines · Evan

[AMD Official Use Only]

Quoted 42 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, October 18, 2021 4:05 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix Polaris12 uvd crash on driver unload

Quoted 10 lines · Evan

[AMD Official Use Only]

Ping..

Quoted 6 lines

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, October 11, 2021 4:28 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Quan, Evan

<[email protected]>

Quoted 9 lines
Quoted 9 lines

Subject: [PATCH] drm/amdgpu: fix Polaris12 uvd crash on driver unload

This is a supplement for the change below:
cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

Change-Id Iedc25e2f572f04772511d56781b01b481e22fd00
---
   drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 +++++++++++++--------

---

Quoted 10 lines
Quoted 10 lines
   1 file changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
index d5d023a24269..2d558c2f417d 100644
@@ -534,6 +534,19 @@ static int uvd_v6_0_hw_fini(void *handle)  {
   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_hw_fini(void *handle) { · line 537

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
+	cancel_delayed_work_sync(&adev->uvd.idle_work);
+

To solve Boris' issue, this patch should be modified such that DPM disable done by the idle job shouldn't be executed during hw_fini. Preventing powergate during suspend is not needed.

[Quan, Evan] This is not intended to fix Boris' issue. It just adds the missing in previous Andrey's fix cdccf1ffe1a3 drm/amdgpu: Fix crash on device remove/driver unload

What I meant is - this cancel delayed work job has the potential (depending on timing) to create the issue that Boris faced during reboot. Additionally this and the below steps will fix Boris' issue (at least I believe so) once DPM disable is skipped in idle job during hw_fini.

Thanks,
Lijo

Quoted 38 lines

BR
Evan

Quoted 36 lines

Thanks,
Lijo

Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +10 -11
+	if (RREG32(mmUVD_STATUS) != 0)
+		uvd_v6_0_stop(adev);
+
+	return 0;
+}
+
+static int uvd_v6_0_suspend(void *handle) {
+	int r;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
   	/*
   	 * Proper cleanups before halting the HW engine:
   	 *   - cancel the delayed idle work
@@ -558,17 +571,6 @@ static int uvd_v6_0_hw_fini(void *handle)
   						       AMD_CG_STATE_GATE);
   	}
 
-	if (RREG32(mmUVD_STATUS) != 0)
-		uvd_v6_0_stop(adev);
-
-	return 0;
-}
-
-static int uvd_v6_0_suspend(void *handle) -{
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
   	r = uvd_v6_0_hw_fini(adev);
   	if (r)
   		return r;
--

2.29.0