Skip to contentSkip to conversation

drm/amd: Warn users about potential s0ix problems

PATCH Superseded Mario Limonciello 2 participants 4 messages Jan 19, 2022 – Jan 21, 2022

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 drm/amd: Warn users about potential s0ix problems

On some OEM setups users can configure the BIOS for S3 or S2idle. When configured to S3 users can still choose 's2idle' in the kernel by using /sys/power/mem_sleep. Before commit 6dc8265f9803 ("drm/amdgpu:
always reset the asic in suspend (v2)"), the GPU would crash. Now when configured this way, the system should resume but will use more power.

As such, adjust the amdpu_acpi_is_s0ix function to warn users about potential power consumption issues during their first attempt at suspending.

---
v3->v4:
* Add back in CONFIG_SUSPEND check
v2->v3:
* Better direct users how to recover in the bad cases
v1->v2:
* Only show messages in s2idle cases

 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +15 -6
index 4811b0faafd9..2531da6cbec3 100644
@@ -1040,11 +1040,20 @@ void amdgpu_acpi_detect(void)
  */
 bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 {
-#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
-	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
-		if (adev->flags & AMD_IS_APU)
-			return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
-	}
-#endif
+#if IS_ENABLED(CONFIG_SUSPEND)
+	if (!(adev->flags & AMD_IS_APU) ||
+	    pm_suspend_target_state != PM_SUSPEND_TO_IDLE)
+		return false;
+#else
 	return false;
+#endif
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+		dev_warn_once(adev->dev,
+			      "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
+			      "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
+#if !IS_ENABLED(CONFIG_AMD_PMC)
+	dev_warn_once(adev->dev,
+		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
+#endif
+	return true;
 }
Signature · 1 line
2.25.1
#1 lore raw

[Public]

Add back on Lijo and Prike, my mistake they got dropped from CC.

Quoted 70 lines

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Tuesday, January 18, 2022 21:41
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Bjoren Dasse <[email protected]>
Subject: [PATCH v4] drm/amd: Warn users about potential s0ix problems

On some OEM setups users can configure the BIOS for S3 or S2idle. When configured to S3 users can still choose 's2idle' in the kernel by using /sys/power/mem_sleep. Before commit 6dc8265f9803 ("drm/amdgpu:
always reset the asic in suspend (v2)"), the GPU would crash. Now when configured this way, the system should resume but will use more power.

As such, adjust the amdpu_acpi_is_s0ix function to warn users about potential power consumption issues during their first attempt at suspending.

---
v3->v4:
* Add back in CONFIG_SUSPEND check
v2->v3:
* Better direct users how to recover in the bad cases
v1->v2:
* Only show messages in s2idle cases

 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +9 -6
index 4811b0faafd9..2531da6cbec3 100644
@@ -1040,11 +1040,20 @@ void amdgpu_acpi_detect(void)
  */
 bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 {
-#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
-	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
-		if (adev->flags & AMD_IS_APU)
-			return pm_suspend_target_state ==
 PM_SUSPEND_TO_IDLE;
-	}
-#endif
+#if IS_ENABLED(CONFIG_SUSPEND)
+	if (!(adev->flags & AMD_IS_APU) ||
+	    pm_suspend_target_state != PM_SUSPEND_TO_IDLE)
+		return false;
+#else
 	return false;
+#endif
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+		dev_warn_once(adev->dev,
+			      "Power consumption will be higher as BIOS has not

been configured for suspend-to-idle.\n"

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
+			      "To use suspend-to-idle change the sleep mode in

BIOS setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+#if !IS_ENABLED(CONFIG_AMD_PMC)
+	dev_warn_once(adev->dev,
+		      "Power consumption will be higher as the kernel has not

been compiled with CONFIG_AMD_PMC.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -1
+#endif
+	return true;
 }
--

2.25.1

#2 lore raw

The S2idle suspend/resume process seems also depends on the CONFIG_SUSPEND. Moreover, why this check function still return true even when BIOS/AMDPMC not configured correctly? You know we still looking into some S0ix abort issue and system will run into such problem when mark those misconfigured case also as s0ix.

Thanks,
Prike

Quoted 85 lines

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Friday, January 21, 2022 3:59 AM
To: [email protected]; Lazar, Lijo <[email protected]>; Liang, Prike <[email protected]>
Cc: Bjoren Dasse <[email protected]>
Subject: RE: [PATCH v4] drm/amd: Warn users about potential s0ix problems

[Public]

Add back on Lijo and Prike, my mistake they got dropped from CC.

Quoted 11 lines

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Tuesday, January 18, 2022 21:41
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Bjoren Dasse <[email protected]>
Subject: [PATCH v4] drm/amd: Warn users about potential s0ix problems

On some OEM setups users can configure the BIOS for S3 or S2idle. When configured to S3 users can still choose 's2idle' in the kernel by using /sys/power/mem_sleep. Before commit 6dc8265f9803

("drm/amdgpu:

Quoted 2 lines

always reset the asic in suspend (v2)"), the GPU would crash. Now when configured this way, the system should resume but will use more

power.

Quoted 16 lines

As such, adjust the amdpu_acpi_is_s0ix function to warn users about potential power consumption issues during their first attempt at suspending.

---
v3->v4:
* Add back in CONFIG_SUSPEND check
v2->v3:
* Better direct users how to recover in the bad cases
v1->v2:
* Only show messages in s2idle cases

Quoted 1 line
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 21 +++++++++++++++-----

-

Quoted 17 lines
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -5
index 4811b0faafd9..2531da6cbec3 100644
@@ -1040,11 +1040,20 @@ void amdgpu_acpi_detect(void)
  */
 bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)  { -#if
 IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
-	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
-		if (adev->flags & AMD_IS_APU)
-			return pm_suspend_target_state ==
 PM_SUSPEND_TO_IDLE;
-	}
-#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_detect(void) · line 1053

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +9 -0
+#if IS_ENABLED(CONFIG_SUSPEND)
+	if (!(adev->flags & AMD_IS_APU) ||
+	    pm_suspend_target_state != PM_SUSPEND_TO_IDLE)
+		return false;
+#else
 	return false;
+#endif
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+		dev_warn_once(adev->dev,
+			      "Power consumption will be higher as BIOS has

not

Quoted 12 lines

been configured for suspend-to-idle.\n"

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
+			      "To use suspend-to-idle change the sleep mode in

BIOS setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+#if !IS_ENABLED(CONFIG_AMD_PMC)
+	dev_warn_once(adev->dev,
+		      "Power consumption will be higher as the kernel has not

been compiled with CONFIG_AMD_PMC.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -1
+#endif
+	return true;
 }
--

2.25.1

#3 lore raw

[Public]

Quoted 5 lines

The S2idle suspend/resume process seems also depends on the CONFIG_SUSPEND. Moreover, why this check function still return true even when BIOS/AMDPMC not configured correctly? You know we still looking into some S0ix abort issue and system will run into such problem when mark those misconfigured case also as s0ix.

If return false then the driver expects to go the "S3 path" which "may" work now after the patches that reset GPU on resume landed.

If you think this is wrong and it should be returning false in this case - then I think we need another function that checks if s3 is actually a valid target. Then in suspend we test if we're doing s3, and we test if we're (safely) doing s0ix. If we can't do either then the GPU stays fully powered up across the suspend cycle and you see these warnings.
Thoughts on that?

Quoted 88 lines

Thanks,
Prike

Quoted 85 lines

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Friday, January 21, 2022 3:59 AM
To: [email protected]; Lazar, Lijo <[email protected]>; Liang, Prike <[email protected]>
Cc: Bjoren Dasse <[email protected]>
Subject: RE: [PATCH v4] drm/amd: Warn users about potential s0ix problems

[Public]

Add back on Lijo and Prike, my mistake they got dropped from CC.

Quoted 11 lines

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Tuesday, January 18, 2022 21:41
To: [email protected]
Cc: Limonciello, Mario <[email protected]>; Bjoren Dasse <[email protected]>
Subject: [PATCH v4] drm/amd: Warn users about potential s0ix problems

On some OEM setups users can configure the BIOS for S3 or S2idle. When configured to S3 users can still choose 's2idle' in the kernel by using /sys/power/mem_sleep. Before commit 6dc8265f9803

("drm/amdgpu:

Quoted 2 lines

always reset the asic in suspend (v2)"), the GPU would crash. Now when configured this way, the system should resume but will use more

power.

Quoted 16 lines

As such, adjust the amdpu_acpi_is_s0ix function to warn users about potential power consumption issues during their first attempt at suspending.

---
v3->v4:
* Add back in CONFIG_SUSPEND check
v2->v3:
* Better direct users how to recover in the bad cases
v1->v2:
* Only show messages in s2idle cases

Quoted 1 line
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 21 +++++++++++++++-----

-

Quoted 17 lines
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -5
index 4811b0faafd9..2531da6cbec3 100644
@@ -1040,11 +1040,20 @@ void amdgpu_acpi_detect(void)
  */
 bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)  { -#if
 IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
-	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
-		if (adev->flags & AMD_IS_APU)
-			return pm_suspend_target_state ==
 PM_SUSPEND_TO_IDLE;
-	}
-#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_detect(void) · line 1053

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +9 -0
+#if IS_ENABLED(CONFIG_SUSPEND)
+	if (!(adev->flags & AMD_IS_APU) ||
+	    pm_suspend_target_state != PM_SUSPEND_TO_IDLE)
+		return false;
+#else
 	return false;
+#endif
+	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+		dev_warn_once(adev->dev,
+			      "Power consumption will be higher as BIOS has

not

Quoted 12 lines

been configured for suspend-to-idle.\n"

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
+			      "To use suspend-to-idle change the sleep mode in

BIOS setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
+#if !IS_ENABLED(CONFIG_AMD_PMC)
+	dev_warn_once(adev->dev,
+		      "Power consumption will be higher as the kernel has not

been compiled with CONFIG_AMD_PMC.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -1
+#endif
+	return true;
 }
--

2.25.1