Skip to contentSkip to conversation

drm/amd: Disallow s0ix without BIOS support again

PATCH Superseded Mario Limonciello 3 participants 9 messages May 30, 2023 – May 31, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd: Disallow s0ix without BIOS support again

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") showed improvements to power consumption over suspend when s0ix wasn't enabled in BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +14 -2
index 3a6b2e2089f6..a3523d03d769 100644
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
+	if (!sched_smt_active()) {
+		dev_warn_once(adev->dev,
+			      "SMT is disabled by the BIOS.\n"
+			      "To use suspend-to-ram enable SMT in BIOS setup.\n");
+	}
+#endif
 	return !(adev->flags & AMD_IS_APU) ||
 		(pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 	 * S0ix even though the system is suspending to idle, so return false
 	 * in that case.
 	 */
-	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+	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");
+		return false;
+	}
 
 #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 /* CONFIG_AMD_PMC */
+	return false;
+#else
 	return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amd: Make lack of `ACPI_FADT_LOW_POWER_S0` or `CONFIG_AMD_PMC` louder during suspend path

Users have reported that s2idle wasn't working on OEM Phoenix systems, but it was root caused to be because CONFIG_AMD_PMC wasn't set in the distribution kernel config.

To make this more apparent, raise the messaging to err instead of warn.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -2
index a3523d03d769..f8b117afd5b1 100644
@@ -1508,14 +1508,14 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 	 * in that case.
 	 */
 	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
-		dev_warn_once(adev->dev,
+		dev_err_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");
 		return false;
 	}
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
-	dev_warn_once(adev->dev,
+	dev_err_once(adev->dev,
 		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
 	return false;
 #else
Signature · 1 line
2.34.1
#2 lore raw
In reply to Mario Limonciello
Quoted 39 lines · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") showed improvements to power consumption over suspend when s0ix wasn't enabled in BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
index 3a6b2e2089f6..a3523d03d769 100644
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +7 -0
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-SMT?

Alex

Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -3
        return !(adev->flags & AMD_IS_APU) ||
                (pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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");
+               return false;
+       }
 
 #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 /* CONFIG_AMD_PMC */
+       return false;
+#else
        return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.34.1

#3 lore raw

[AMD Official Use Only - General]

Quoted 58 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 30, 2023 1:16 PM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 2 lines · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")

showed

Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 11 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

Quoted 6 lines

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

Cc: Rafael Ávila de Espíndola <[email protected]>
Link:

https://github.com/torvalds/linux/blob/v6.1/drivers/gpu/drm/amd/amdgpu
/amdgpu_acpi.c#L1060

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Quoted 16 lines

index 3a6b2e2089f6..a3523d03d769 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -0
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-SMT?

Yeah; it could. I'm not sure how we can reliably detect this. I thought about looking for the 'ht' flag, but that probably wouldn't work for this case.

Are there AMD Zen CPUs or APUs that are non-SMT? Could gate the sched_smt_active() check to only run when it's an AMD x86 Zen SoC.

Quoted 36 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
        return !(adev->flags & AMD_IS_APU) ||
                (pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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 bool amdgpu_acpi_is_s0ix_active(struct · line 1513

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

setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
+               return false;
+       }
 
 #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");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -2
-#endif /* CONFIG_AMD_PMC */
+       return false;
+#else
        return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.34.1

#4 lore raw

As far as I know the "no S3 if SMT off" is just an oddity of the particular BIOS I got on the "B550I AORUS PRO AX".

Also, what has changed that would prevent the same issue I was hitting before?:

https://gitlab.freedesktop.org/drm/amd/-/issues/2364#note_1735422

Cheers,
Rafael

Quoted 111 lines · Mario

[AMD Official Use Only - General]

Quoted 58 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 30, 2023 1:16 PM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 2 lines · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")

showed

Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 11 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

Quoted 6 lines

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

Cc: Rafael Ávila de Espíndola <[email protected]>
Link:

https://github.com/torvalds/linux/blob/v6.1/drivers/gpu/drm/amd/amdgpu
/amdgpu_acpi.c#L1060

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Quoted 16 lines

index 3a6b2e2089f6..a3523d03d769 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -0
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-SMT?

Yeah; it could. I'm not sure how we can reliably detect this. I thought about looking for the 'ht' flag, but that probably wouldn't work for this case.

Are there AMD Zen CPUs or APUs that are non-SMT? Could gate the sched_smt_active() check to only run when it's an AMD x86 Zen SoC.

Quoted 36 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
        return !(adev->flags & AMD_IS_APU) ||
                (pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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 bool amdgpu_acpi_is_s0ix_active(struct · line 1513

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

setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
+               return false;
+       }
 
 #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");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -2
-#endif /* CONFIG_AMD_PMC */
+       return false;
+#else
        return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.34.1

#5 lore raw

[AMD Official Use Only - General]

Quoted 2 lines

As far as I know the "no S3 if SMT off" is just an oddity of the particular BIOS I got on the "B550I AORUS PRO AX".

In that case, maybe the message should be downgraded to INFO, and only shown in the case that s3 is not supported on APUs. This will narrow it quite a bit then.

Quoted 6 lines

Also, what has changed that would prevent the same issue I was hitting before?:

https://gitlab.freedesktop.org/drm/amd/-/issues/2364#note_1735422

This commit in 6.3:
ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Quoted 121 lines

Cheers,
Rafael

Quoted 9 lines · Mario

[AMD Official Use Only - General]

Quoted 7 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 30, 2023 1:16 PM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support

again

Quoted 19 lines
Quoted 19 lines
Quoted 2 lines · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")

showed

Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 11 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

Cc: Rafael Ávila de Espíndola <[email protected]>
Link:

https://github.com/torvalds/linux/blob/v6.1/drivers/gpu/drm/amd/amdgpu

Quoted 25 lines
Quoted 25 lines

/amdgpu_acpi.c#L1060

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Quoted 16 lines

index 3a6b2e2089f6..a3523d03d769 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -0
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-

SMT?

Quoted 2 lines

Yeah; it could. I'm not sure how we can reliably detect this. I thought about

looking for

Quoted 3 lines

the 'ht' flag, but that probably wouldn't work for this case.

Are there AMD Zen CPUs or APUs that are non-SMT? Could gate the

sched_smt_active()

Quoted 38 lines

check to only run when it's an AMD x86 Zen SoC.

Quoted 36 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
        return !(adev->flags & AMD_IS_APU) ||
                (pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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 bool amdgpu_acpi_is_s0ix_active(struct · line 1513

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

setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
+               return false;
+       }
 
 #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");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -2
-#endif /* CONFIG_AMD_PMC */
+       return false;
+#else
        return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.34.1

#6 lore raw

[AMD Official Use Only - General]

Quoted 8 lines

-----Original Message-----
From: Limonciello, Mario
Sent: Tuesday, May 30, 2023 1:38 PM
To: Rafael Ávila de Espíndola <[email protected]>; Alex Deucher <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 6 lines
Quoted 2 lines

As far as I know the "no S3 if SMT off" is just an oddity of the particular BIOS I got on the "B550I AORUS PRO AX".

In that case, maybe the message should be downgraded to INFO, and only shown in the case that s3 is not supported on APUs. This will narrow it quite a bit then.

Here's my proposal to narrow it down better.

bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)

{
        /* dGPUs always go to S3 */
        if (!(adev->flags & AMD_IS_APU))
                return true;
        /* the kernel has found support for S3 and user selected it */
        if (pm_suspend_target_state == PM_SUSPEND_MEM)
                return true;
#ifdef CONFIG_X86
        if (boot_cpu_has(X86_FEATURE_ZEN) && !sched_smt_active()) {
                dev_info_once(adev->dev,
                              "SMT is disabled (possibly by the BIOS).\n"
                              "To use suspend-to-ram enable SMT in BIOS setup.\n");
        }
#endif
        return false;
}
Quoted 137 lines
Quoted 7 lines

Also, what has changed that would prevent the same issue I was hitting before?:

https://gitlab.freedesktop.org/drm/amd/-/issues/2364#note_1735422

This commit in 6.3:
ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Quoted 7 lines

Cheers,
Rafael

Quoted 2 lines · Mario

[AMD Official Use Only - General]

Quoted 19 lines
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 30, 2023 1:16 PM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support

again

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")

showed

Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 3 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system

didn't

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

Cc: Rafael Ávila de Espíndola <[email protected]>
Link:

https://github.com/torvalds/linux/blob/v6.1/drivers/gpu/drm/amd/amdgpu

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

/amdgpu_acpi.c#L1060

Quoted 4 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16

++++++++++++++--

Quoted 28 lines
Quoted 20 lines
Quoted 20 lines

Review

Quoted 3 lines
 1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Quoted 16 lines

index 3a6b2e2089f6..a3523d03d769 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -0
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-

Quoted 3 lines

SMT?

Quoted 2 lines

Yeah; it could. I'm not sure how we can reliably detect this. I thought

about

Quoted 31 lines

looking for

Quoted 3 lines

the 'ht' flag, but that probably wouldn't work for this case.

Are there AMD Zen CPUs or APUs that are non-SMT? Could gate the

sched_smt_active()

Quoted 26 lines

check to only run when it's an AMD x86 Zen SoC.

Quoted 24 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
        return !(adev->flags & AMD_IS_APU) ||
                (pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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 bool amdgpu_acpi_is_s0ix_active(struct · line 1513

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

setup.\n");

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
+               return false;
+       }
 
 #if !IS_ENABLED(CONFIG_AMD_PMC)
        dev_warn_once(adev->dev,
                      "Power consumption will be higher as the kernel has not

been

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

compiled with CONFIG_AMD_PMC.\n");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -2
-#endif /* CONFIG_AMD_PMC */
+       return false;
+#else
        return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.34.1

#7 lore raw
In reply to Limonciello, Mario
Quoted 70 lines · Mario

[AMD Official Use Only - General]

Quoted 58 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 30, 2023 1:16 PM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 2 lines · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")

showed

Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 11 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

Quoted 6 lines

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

Cc: Rafael Ávila de Espíndola <[email protected]>
Link:

https://github.com/torvalds/linux/blob/v6.1/drivers/gpu/drm/amd/amdgpu
/amdgpu_acpi.c#L1060

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Quoted 16 lines

index 3a6b2e2089f6..a3523d03d769 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
@@ -28,6 +28,7 @@
 #include <linux/xarray.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
 #include <linux/suspend.h>
 #include <acpi/video.h>
 #include <acpi/actbl.h>
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
  */
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_X86
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -0
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-SMT?

Quoted 5 lines

Yeah; it could. I'm not sure how we can reliably detect this. I thought about looking for the 'ht' flag, but that probably wouldn't work for this case.

Are there AMD Zen CPUs or APUs that are non-SMT? Could gate the sched_smt_active() check to only run when it's an AMD x86 Zen SoC.

Some of the more budget conscient Athlon parts don't have SMT IIRC.

Alex

Quoted 37 lines
Quoted 37 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
        return !(adev->flags & AMD_IS_APU) ||
                (pm_suspend_target_state == PM_SUSPEND_MEM);
 }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
         * S0ix even though the system is suspending to idle, so return false
         * in that case.
         */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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 bool amdgpu_acpi_is_s0ix_active(struct · line 1513

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

setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
+               return false;
+       }
 
 #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");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -2
-#endif /* CONFIG_AMD_PMC */
+       return false;
+#else
        return true;
+#endif /* CONFIG_AMD_PMC */
 }
 
 #endif /* CONFIG_SUSPEND */
--

2.34.1

#8 lore raw
Quoted 68 lines · Alex Deucher
Quoted 66 lines · Mario

[AMD Official Use Only - General]

Quoted 64 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, May 30, 2023 1:16 PM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 1 line · Mario Limonciello

commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support")

showed

Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 11 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system didn't support S3 was because SMT was disabled in OEM BIOS setup. This prevented the BIOS from allowing S3.

Also allowing GPUs to use the s2idle path actually causes problems if they're invoked on systems that may not support s2idle in the platform firmware. systemd has a tendency to try to use s2idle if deep fails for any reason, which could lead to unexpected flows.

Quoted 6 lines

To make this the behavior discoverable and expected, revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") and offer a message if SMT appears to be disabled.

Cc: Rafael Ávila de Espíndola <[email protected]>
Link:

https://github.com/torvalds/linux/blob/v6.1/drivers/gpu/drm/amd/amdgpu
/amdgpu_acpi.c#L1060

Review

Quoted 7 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Quoted 12 lines

index 3a6b2e2089f6..a3523d03d769 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
@@ -28,6 +28,7 @@
  #include <linux/xarray.h>
  #include <linux/power_supply.h>
  #include <linux/pm_runtime.h>
+#include <linux/sched/smt.h>
  #include <linux/suspend.h>
  #include <acpi/video.h>
  #include <acpi/actbl.h>

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c void amdgpu_acpi_release(void) · line 1483

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +7 -0
@@ -1473,6 +1474,13 @@ void amdgpu_acpi_release(void)
   */
  bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
  {
+#ifdef CONFIG_X86
+       if (!sched_smt_active()) {
+               dev_warn_once(adev->dev,
+                             "SMT is disabled by the BIOS.\n"
+                             "To use suspend-to-ram enable SMT in BIOS setup.\n");
+       }
+#endif

Will this generate a spurious warning on platforms that are natively non-SMT?

Quoted 8 lines
Quoted 5 lines

Yeah; it could. I'm not sure how we can reliably detect this. I thought about looking for the 'ht' flag, but that probably wouldn't work for this case.

Are there AMD Zen CPUs or APUs that are non-SMT? Could gate the sched_smt_active() check to only run when it's an AMD x86 Zen SoC.

Some of the more budget conscient Athlon parts don't have SMT IIRC.

Alex

In that case, I think the best solution is to just revert cf488dcd0ab7.

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
         return !(adev->flags & AMD_IS_APU) ||
                 (pm_suspend_target_state == PM_SUSPEND_MEM);
  }
@@ -1499,16 +1507,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
          * S0ix even though the system is suspending to idle, so return false
          * in that case.
          */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+       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 bool amdgpu_acpi_is_s0ix_active(struct · line 1513

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

setup.\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +2 -0
+               return false;
+       }
 
  #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");

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -2
-#endif /* CONFIG_AMD_PMC */
+       return false;
+#else
         return true;
+#endif /* CONFIG_AMD_PMC */
  }
 
  #endif /* CONFIG_SUSPEND */
--

2.34.1