drm/amdgpu: reset asic after system-wide suspend aborted (v3)
Subsystems (2)
PATCH v3 1/1 drm/amdgpu: reset asic after system-wide suspend aborted (v3)
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.
v3: Some dGPU reset method not support at the early resume time and temprorary skip the dGPU case.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
@@ -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->flags &AMD_IS_APU ) +amdgpu_asic_reset (adev);/* post card */ if (amdgpu_device_need_post (adev)) { r =amdgpu_device_asic_init (adev);
Signature · 1 line
2.7.4
Quoted 22 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.
v3: Some dGPU reset method not support at the early resume time and temprorary skip the dGPU case.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -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
-0amdgpu_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->flags &AMD_IS_APU ) +amdgpu_asic_reset (adev);
Ideally you only want this to happen on S3 right? So shouldn't there be an extra check for amdgpu_acpi_is_s0ix_active?
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);
Quoted 26 lines · Mario
Quoted 24 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.
v3: Some dGPU reset method not support at the early resume time and temprorary skip the dGPU case.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -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);
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 3993
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+/*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->flags &AMD_IS_APU ) +amdgpu_asic_reset (adev);Ideally you only want this to happen on S3 right? So shouldn't there be an extra check for
amdgpu_acpi_is_s0ix_active?
Shouldn't matter on the resume side. Only the suspend side. If we reset in suspend, we'd end up disabling gfxoff. On the resume side, it should safe, but the resume paths for various IPs probably are not adequate to deal with a reset for S0i3 since they don't re-init as much hardware. So it's probably better to skip this for S0i3.
Alex
Quoted 6 lines
Quoted 5 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);
[Public]
Quoted 57 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, December 2, 2021 3:39 AM
To: Limonciello, Mario <[email protected]>
Cc: Liang, Prike <[email protected]>; amd-gfx list <amd- [email protected]>; Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [v3] drm/amdgpu: reset asic after system-wide suspend aborted (v3)Quoted 18 lines · Mario
Quoted 16 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.
v3: Some dGPU reset method not support at the early resume time and temprorary skip the dGPU case.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3983,6 +3983,14 @@ int amdgpu_device_resume(struct
drm_device*dev, bool fbcon)Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0if (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.
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct · line 3989
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,
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct · line 3990
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
Quoted 7 lines
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->flags &AMD_IS_APU ) +amdgpu_asic_reset (adev);Ideally you only want this to happen on S3 right? So shouldn't there be an extra check for
amdgpu_acpi_is_s0ix_active?
Quoted 8 lines
Shouldn't matter on the resume side. Only the suspend side. If we reset in suspend, we'd end up disabling gfxoff. On the resume side, it should safe, but the resume paths for various IPs probably are not adequate to deal with a reset for S0i3 since they don't re-init as much hardware. So it's probably better to skip this for S0i3.
Alex
There's may some IP suspend/resume sequence not program correctly and when abort the s2idle after AMDGPU suspend can see some other error in the SMU/SDMA resume. However, that seems different symptom in the S3 abort case and will handle it separately.
Quoted 7 lines
Quoted 7 lines
Quoted 6 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);
Quoted 10 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.
v3: Some dGPU reset method not support at the early resume time and temprorary skip the dGPU case.
FYI to you that this was tested on an issue with S3 exit to show success that you will want to include in a Fixes tag for v4 when you change it to just run for S3 path, not S0i3 path.
https://gitlab.freedesktop.org/drm/amd/-/issues/1822
Quoted 26 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0@@ -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->flags &AMD_IS_APU ) +amdgpu_asic_reset (adev);/* post card */ if (amdgpu_device_need_post (adev)) { r =amdgpu_device_asic_init (adev);
[Public]
Quoted 18 lines
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Tuesday, December 14, 2021 5:48 AM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [v3] drm/amdgpu: reset asic after system-wide suspend aborted (v3)Quoted 8 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.
Quoted 9 lines
Quoted 2 lines
v3: Some dGPU reset method not support at the early resume time and temprorary skip the dGPU case.
FYI to you that this was tested on an issue with S3 exit to show success that you will want to include in a Fixes tag for v4 when you change it to just run for S3 path, not S0i3 path.
Yeah this patch need exclude for S0i3 case, in the S0i3 entry we skip some blocks suspend so we may not resume successfully after do GPU reset for S0i3 case. Furthermore, for S3 abort resume issue also can find on the dGPU series and Alex's following patch may can handle this generic issue better when we ignore the PM abort check.
Thanks,
Prike
Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device
Quoted 12 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -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
-0if (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
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+* firstly. +*/ +if (adev->flags &AMD_IS_APU ) +amdgpu_asic_reset (adev);/* post card */ if (amdgpu_device_need_post (adev)) { r =amdgpu_device_asic_init (adev);