drm/amd: Don't reset dGPUs if the system is going to s2idle
Subsystems (2)
PATCH 1/1 drm/amd: Don't reset dGPUs if the system is going to s2idle
An A+A configuration on ASUS ROG Strix G513QY proves that the ASIC reset for handling aborted suspend can't work with s2idle.
This functionality was introduced in commit daf8de0874ab5b ("drm/amdgpu:
always reset the asic in suspend (v2)"). A few other commits have gone on top of the ASIC reset, but this still doesn't work on the A+A configuration in s2idle.
Avoid doing the reset on dGPUs specifically when using s2idle.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1378,6 +1378,7 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; }
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +14 -0
@@ -1045,6 +1045,20 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) (pm_suspend_target_state ==PM_SUSPEND_MEM ); } +/** +* amdgpu_acpi_should_gpu_reset +* +* @adev: amdgpu_device_pointer +* +* returns true if should reset GPU, false if not +*/ +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev) +{ +if (adev->flags &AMD_IS_APU ) +return false; +return pm_suspend_target_state !=PM_SUSPEND_TO_IDLE ; +} +/** * amdgpu_acpi_is_s0ix_active *
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -2315,7 +2315,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); -if (!adev->in_s0ix) +if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);return 0 ;
Signature · 1 line
2.34.1
Quoted 9 lines · Mario Limonciello
An A+A configuration on ASUS ROG Strix G513QY proves that the ASIC reset for handling aborted suspend can't work with s2idle.
This functionality was introduced in commit
daf8de0874ab5b("drm/amdgpu:
always reset the asic in suspend (v2)"). A few other commits have gone on top of the ASIC reset, but this still doesn't work on the A+A configuration in s2idle.
Quoted 5 lines
Avoid doing the reset on dGPUs specifically when using s2idle.
Fixes daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)")Signed-off-by Mario Limonciello <[email protected]>
But I think maybe we should just drop all of this in the longer term. We are slowly dropping every case where we reset the GPU. I'm not even sure it actually fixes the issue it was originally added to fix at this point because the actual reset has moved to the no-irq callback which will most likely not get called on an aborted suspend anyway.
Alex
Quoted 59 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1378,6 +1378,7 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; }drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +14
-0@@ -1045,6 +1045,20 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) (pm_suspend_target_state ==PM_SUSPEND_MEM ); } +/** +* amdgpu_acpi_should_gpu_reset +* +* @adev: amdgpu_device_pointer +* +* returns true if should reset GPU, false if not +*/ +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev) +{ +if (adev->flags &AMD_IS_APU ) +return false; +return pm_suspend_target_state !=PM_SUSPEND_TO_IDLE ; +} +/** * amdgpu_acpi_is_s0ix_active * drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2@@ -2315,7 +2315,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); -if (!adev->in_s0ix) +if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);return 0 ; --2.34.1
[Public]
Quoted 35 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 17, 2022 08:43
To: Limonciello, Mario <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idleQuoted 5 lines · Mario Limonciello
An A+A configuration on ASUS ROG Strix G513QY proves that the ASIC reset for handling aborted suspend can't work with s2idle.
This functionality was introduced in commit
daf8de0874ab5b("drm/amdgpu:
Quoted 7 lines
always reset the asic in suspend (v2)"). A few other commits have gone on top of the ASIC reset, but this still doesn't work on the A+A configuration in s2idle.
Avoid doing the reset on dGPUs specifically when using s2idle.
Fixes daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend(v2)")
Quoted 1 line
Link:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitla
b.freedesktop.org%2Fdrm%2Famd%2F- %2Fissues%2F2008&data=05%7C01%7Cmario.limonciello%40amd.com% 7C38a880b8d03147194bb608da380b3142%7C3dd8961fe4884e608e11a82d994 e183d%7C0%7C0%7C637883917968950850%7CUnknown%7CTWFpbGZsb3d8 eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 D%7C3000%7C%7C%7C&sdata=lNeeucWFganu9GLey2YAqXfgbYT4DUBb fQA6XuwGslA%3D&reserved=0Quoted 1 line
Signed-off-by Mario Limonciello <[email protected]>
Quoted 9 lines
Acked-by Alex Deucher <[email protected]>But I think maybe we should just drop all of this in the longer term. We are slowly dropping every case where we reset the GPU. I'm not even sure it actually fixes the issue it was originally added to fix at this point because the actual reset has moved to the no-irq callback which will most likely not get called on an aborted suspend anyway.
So perhaps for now this patch and in the next cycle or two maybe folks who worked on the aborted suspend case can try to trigger an aborted suspend w/ dGPUs + S3 and see whether it's actually working and tear everything out if it doesn't as you say.
Quoted 68 lines
Alex
Review
Quoted 7 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu.hdrivers/gpu/drm/amd/amdgpu/amdgpu.h static inline int
Quoted 4 lines
index
3c20c2eadf4e..9cf3d65f17d7100644drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1378,6 +1378,7 @@ static inline intamdgpu_acpi_smart_shift_update(struct
drm_device*dev,drivers/gpu/drm/amd/amdgpu/amdgpu.h static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device*adev) { return false; }
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.cdrivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s3_active(struct
Quoted 4 lines
index
0e12315fa0cb..98ac53ee6bb5100644drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0
-0@@ -1045,6 +1045,20 @@ bool amdgpu_acpi_is_s3_active(struct
amdgpu_device*adev)Review
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +14
-0(pm_suspend_target_state ==PM_SUSPEND_MEM ); } +/** +* amdgpu_acpi_should_gpu_reset +* +* @adev: amdgpu_device_pointer +* +* returns true if should reset GPU, false if not +*/ +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev) +{ +if (adev->flags &AMD_IS_APU ) +return false; +return pm_suspend_target_state !=PM_SUSPEND_TO_IDLE ; +} +/** * amdgpu_acpi_is_s0ix_active * (quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.cdrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct
Quoted 4 lines
index
16871baee784..a84766c13ac5100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2315,7 +2315,7 @@ static int amdgpu_pmops_suspend_noirq(structdevice *dev)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); -if (!adev->in_s0ix) +if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);return 0 ; --2.34.1
Quoted 50 lines · Mario
[Public]
Quoted 35 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 17, 2022 08:43
To: Limonciello, Mario <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idleQuoted 5 lines · Mario Limonciello
An A+A configuration on ASUS ROG Strix G513QY proves that the ASIC reset for handling aborted suspend can't work with s2idle.
This functionality was introduced in commit
daf8de0874ab5b("drm/amdgpu:
Quoted 7 lines
always reset the asic in suspend (v2)"). A few other commits have gone on top of the ASIC reset, but this still doesn't work on the A+A configuration in s2idle.
Avoid doing the reset on dGPUs specifically when using s2idle.
Fixes daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend(v2)")
Quoted 1 line
Link:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitla
b.freedesktop.org%2Fdrm%2Famd%2F- %2Fissues%2F2008&data=05%7C01%7Cmario.limonciello%40amd.com% 7C38a880b8d03147194bb608da380b3142%7C3dd8961fe4884e608e11a82d994 e183d%7C0%7C0%7C637883917968950850%7CUnknown%7CTWFpbGZsb3d8 eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 D%7C3000%7C%7C%7C&sdata=lNeeucWFganu9GLey2YAqXfgbYT4DUBb fQA6XuwGslA%3D&reserved=0Quoted 1 line
Signed-off-by Mario Limonciello <[email protected]>Quoted 9 lines
Acked-by Alex Deucher <[email protected]>But I think maybe we should just drop all of this in the longer term. We are slowly dropping every case where we reset the GPU. I'm not even sure it actually fixes the issue it was originally added to fix at this point because the actual reset has moved to the no-irq callback which will most likely not get called on an aborted suspend anyway.
Quoted 4 lines
So perhaps for now this patch and in the next cycle or two maybe folks who worked on the aborted suspend case can try to trigger an aborted suspend w/ dGPUs + S3 and see whether it's actually working and tear everything out if it doesn't as you say.
Yes, that was my thinking.
Alex
Quoted 68 lines
Quoted 68 lines
Alex
Review
Quoted 7 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu.hdrivers/gpu/drm/amd/amdgpu/amdgpu.h static inline int
Quoted 4 lines
index
3c20c2eadf4e..9cf3d65f17d7100644drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1378,6 +1378,7 @@ static inline intamdgpu_acpi_smart_shift_update(struct
drm_device*dev,drivers/gpu/drm/amd/amdgpu/amdgpu.h static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device*adev) { return false; }
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.cdrivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s3_active(struct
Quoted 4 lines
index
0e12315fa0cb..98ac53ee6bb5100644drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0
-0@@ -1045,6 +1045,20 @@ bool amdgpu_acpi_is_s3_active(struct
amdgpu_device*adev)Review
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +14
-0(pm_suspend_target_state ==PM_SUSPEND_MEM ); } +/** +* amdgpu_acpi_should_gpu_reset +* +* @adev: amdgpu_device_pointer +* +* returns true if should reset GPU, false if not +*/ +bool amdgpu_acpi_should_gpu_reset (struct amdgpu_device *adev) +{ +if (adev->flags &AMD_IS_APU ) +return false; +return pm_suspend_target_state !=PM_SUSPEND_TO_IDLE ; +} +/** * amdgpu_acpi_is_s0ix_active * (quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.cdrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct
Quoted 4 lines
index
16871baee784..a84766c13ac5100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2315,7 +2315,7 @@ static int amdgpu_pmops_suspend_noirq(structdevice *dev)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); -if (!adev->in_s0ix) +if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);return 0 ; --2.34.1
[Public]
A couple of things -
PM_SUSPEND_TO_IDLE should be under a compile guard
It makes sense to rename to something like amdgpu_need_reset_on_suspend() as it decides on reset only for a suspend situation.
Thanks,
Lijo
[Public]
Quoted 1 line
PM_SUSPEND_TO_IDLEshould be under a compile guard
It is actually. All of the amdgpu_acpi_* are. It's not obvious though looking at the patch, you need to apply it to notice it.
Quoted 1 line
It makes sense to rename to something like
amdgpu_need_reset_on_suspend()as it decides on reset only for a suspend situation.
Remember it's in amdgpu_acpi.c. So it would be amdgpu_acpi_need_reset_on_suspend()? It's a bit lengthy.
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, May 17, 2022 11:25
To: Limonciello, Mario <[email protected]>; [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle
[Public]
A couple of things -
PM_SUSPEND_TO_IDLE should be under a compile guard
It makes sense to rename to something like amdgpu_need_reset_on_suspend() as it decides on reset only for a suspend situation.
Thanks,
Lijo
Quoted 13 lines · Mario
[Public]
Quoted 1 line
PM_SUSPEND_TO_IDLEshould be under a compile guardIt is actually. All of the amdgpu_acpi_* are. It’s not obvious though looking at the patch, you need to apply it to notice it.
Quoted 5 lines
Quoted 1 line
It makes sense to rename to something like
amdgpu_need_reset_on_suspend()as it decides on reset only for a suspend situation.Remember it’s in
amdgpu_acpi.c. So it would beamdgpu_acpi_need_reset_on_suspend()? It’s a bit lengthy.
You'll need to add a stub version of the function for the !CONFIG_ACPI and !CONFIG_SUSPEND case since it's called in amdgpu_drv.c
Alex
Quoted 29 lines
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, May 17, 2022 11:25
To: Limonciello, Mario <[email protected]>; [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle[Public]
A couple of things -
PM_SUSPEND_TO_IDLEshould be under a compile guardIt makes sense to rename to something like
amdgpu_need_reset_on_suspend()as it decides on reset only for a suspend situation.Thanks,
Lijo
[Public]
Ya, second is too lengthy. Better to leave it as it is.
BTW, is this specific to reset by BACO? BACO entry/exit may take longer (better chance of suspend entry abort by some wake-up source).
Thanks,
Lijo
________________________________
From: Limonciello, Mario <[email protected]>
Sent: Tuesday, May 17, 2022 10:00:16 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Subject: RE: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle
[Public]
Quoted 1 line
PM_SUSPEND_TO_IDLEshould be under a compile guard
It is actually. All of the amdgpu_acpi_* are. It’s not obvious though looking at the patch, you need to apply it to notice it.
Quoted 1 line
It makes sense to rename to something like
amdgpu_need_reset_on_suspend()as it decides on reset only for a suspend situation.
Remember it’s in amdgpu_acpi.c. So it would be amdgpu_acpi_need_reset_on_suspend()? It’s a bit lengthy.
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, May 17, 2022 11:25
To: Limonciello, Mario <[email protected]>; [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle
[Public]
A couple of things -
PM_SUSPEND_TO_IDLE should be under a compile guard
It makes sense to rename to something like amdgpu_need_reset_on_suspend() as it decides on reset only for a suspend situation.
Thanks,
Lijo
[Public]
No, it mode2 reset that it uses for failure case.
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, May 17, 2022 11:51
To: Limonciello, Mario <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle
[Public]
Ya, second is too lengthy. Better to leave it as it is.
BTW, is this specific to reset by BACO? BACO entry/exit may take longer (better chance of suspend entry abort by some wake-up source).
Thanks,
Lijo
________________________________
From: Limonciello, Mario <[email protected]<mailto:[email protected]>>
Sent: Tuesday, May 17, 2022 10:00:16 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle
[Public]
Quoted 1 line
PM_SUSPEND_TO_IDLEshould be under a compile guard
It is actually. All of the amdgpu_acpi_* are. It's not obvious though looking at the patch, you need to apply it to notice it.
Quoted 1 line
It makes sense to rename to something like
amdgpu_need_reset_on_suspend()as it decides on reset only for a suspend situation.
Remember it's in amdgpu_acpi.c. So it would be amdgpu_acpi_need_reset_on_suspend()? It's a bit lengthy.
From: Lazar, Lijo <[email protected]<mailto:[email protected]>>
Sent: Tuesday, May 17, 2022 11:25
To: Limonciello, Mario <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Limonciello, Mario <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] drm/amd: Don't reset dGPUs if the system is going to s2idle
[Public]
A couple of things -
PM_SUSPEND_TO_IDLE should be under a compile guard
It makes sense to rename to something like amdgpu_need_reset_on_suspend() as it decides on reset only for a suspend situation.
Thanks,
Lijo