Skip to contentSkip to conversation

drm/amdgpu: reset asic after system-wide suspend aborted (v2)

PATCH Superseded Prike Liang 2 participants 3 messages Nov 24, 2021 – Nov 25, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: reset asic after system-wide suspend aborted (v2)

Do ASIC reset at the moment Sx suspend aborted behind of amdgpu suspend to keep AMDGPU in a clean reset state and that can avoid re-initialize device improperly error. Currently,we just always do asic reset in the amdgpu resume until sort out the PM abort case.

v2: Remove incomplete PM abort flag and add GPU hive case check for GPU reset.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
index 7d4115d..3fcd90d 100644
@@ -3983,6 +3983,14 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
 	if (adev->in_s0ix)
 		amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry);
 
+	/*TODO: In order to not let all-always asic reset affect resume latency
+	 * need sort out the case which really need asic reset in the resume process.
+	 * As to the known issue on the system suspend abort behind the AMDGPU suspend,
+	 * may can sort this case by checking struct suspend_stats which need exported
+	 * firstly.
+	 */
+	if (adev->gmc.xgmi.num_physical_nodes <= 1)
+		amdgpu_asic_reset(adev);
 	/* post card */
 	if (amdgpu_device_need_post(adev)) {
 		r = amdgpu_device_asic_init(adev);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 19 lines · Prike Liang

Do ASIC reset at the moment Sx suspend aborted behind of amdgpu suspend to keep AMDGPU in a clean reset state and that can avoid re-initialize device improperly error. Currently,we just always do asic reset in the amdgpu resume until sort out the PM abort case.

v2: Remove incomplete PM abort flag and add GPU hive case check for GPU reset.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 7d4115d..3fcd90d 100644
@@ -3983,6 +3983,14 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
  	if (adev->in_s0ix)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 3993

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
  		amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry);
 
+	/*TODO: In order to not let all-always asic reset affect resume latency
+	 * need sort out the case which really need asic reset in the resume process.
+	 * As to the known issue on the system suspend abort behind the AMDGPU suspend,
+	 * may can sort this case by checking struct suspend_stats which need exported
+	 * firstly.
+	 */
+	if (adev->gmc.xgmi.num_physical_nodes <= 1)
+		amdgpu_asic_reset(adev);

Newer dGPUs depend on PMFW to do reset and that is not loaded at this point. For some, there is a mini FW available which could technically handle a reset and some of the older ones depend on PSP. Strongly suggest to check all such cases before doing a reset here.

Or, the safest at this point could be to do the reset only for APUs.

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
  	/* post card */
  	if (amdgpu_device_need_post(adev)) {
  		r = amdgpu_device_asic_init(adev);
#2 lore raw

[Public]

Quoted 54 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, November 24, 2021 9:30 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH v2] drm/amdgpu: reset asic after system-wide suspend aborted (v2)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device

Quoted 19 lines · Prike Liang

Do ASIC reset at the moment Sx suspend aborted behind of amdgpu suspend to keep AMDGPU in a clean reset state and that can avoid re-initialize device improperly error. Currently,we just always do asic reset in the amdgpu resume until sort out the PM abort case.

v2: Remove incomplete PM abort flag and add GPU hive case check for GPU reset.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 7d4115d..3fcd90d 100644
@@ -3983,6 +3983,14 @@ int amdgpu_device_resume(struct drm_device

*dev, bool fbcon)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device · line 3984

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
    if (adev->in_s0ix)
            amdgpu_gfx_state_change_set(adev,

sGpuChangeState_D0Entry);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device · line 3985

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+   /*TODO: In order to not let all-always asic reset affect resume

latency

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device · line 3986

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+    * need sort out the case which really need asic reset in the resume

process.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device · line 3987

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+    * As to the known issue on the system suspend abort behind the

AMDGPU suspend,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device · line 3988

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+    * may can sort this case by checking struct suspend_stats which

need exported

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 3993

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
+    * firstly.
+    */
+   if (adev->gmc.xgmi.num_physical_nodes <= 1)
+           amdgpu_asic_reset(adev);

Newer dGPUs depend on PMFW to do reset and that is not loaded at this point. For some, there is a mini FW available which could technically handle a reset and some of the older ones depend on PSP. Strongly suggest to check all such cases before doing a reset here.

Quoted 5 lines

Or, the safest at this point could be to do the reset only for APUs.

Thanks,
Lijo

Thanks for the input, that may need a lot of effort to sort out reset method from many dGPUs. So in this time let's only handle APUs firstly.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
    /* post card */
    if (amdgpu_device_need_post(adev)) {
            r = amdgpu_device_asic_init(adev);