Skip to contentSkip to conversation

drm/amd: Disallow s0ix without BIOS support again

PATCH In review Mario Limonciello 2 participants 11 messages May 30, 2023 – Jun 1, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

The original commit also fixed a problem during resume from suspend to idle without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") to make it match the expected behavior again.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -2
index aeeec211861c..e1b01554e323 100644
@@ -1092,16 +1092,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 v2 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 e1b01554e323..fd6e83795873 100644
@@ -1093,14 +1093,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
Reviewed-by on v2 1/2
#2 lore raw
In reply to Mario Limonciello
Quoted 18 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.

The original commit also fixed a problem during resume from suspend to idle without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Quoted 7 lines

Revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") to make it match the expected behavior again.

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Alex

Quoted 34 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -3
index aeeec211861c..e1b01554e323 100644
@@ -1092,16 +1092,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
Quoted 23 lines · Alex Deucher
Quoted 21 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.

The original commit also fixed a problem during resume from suspend to idle without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") to make it match the expected behavior again.

Quoted 7 lines
Quoted 4 lines

Patch 1 is:

Thx.

Quoted 4 lines

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

warn and WARN are two different things. I think you're right about WARN, that does look like a crash to most people.

Modern versions of both util-linux (for dmesg command) and systemd (for journalctl command) will apply coloring for different message levels.

For both specifically there is red coloring when there is an 'err' and "bold" white coloring when it's 'warn'.

Quoted 37 lines

Alex

Quoted 34 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -3
index aeeec211861c..e1b01554e323 100644
@@ -1092,16 +1092,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

#4 lore raw
Quoted 40 lines · Mario Limonciello
Quoted 23 lines · Alex Deucher
Quoted 21 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.

The original commit also fixed a problem during resume from suspend to idle without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") to make it match the expected behavior again.

Quoted 7 lines
Quoted 4 lines

Patch 1 is:

Thx.

Quoted 4 lines

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Quoted 8 lines

warn and WARN are two different things. I think you're right about WARN, that does look like a crash to most people.

Modern versions of both util-linux (for dmesg command) and systemd (for journalctl command) will apply coloring for different message levels.

For both specifically there is red coloring when there is an 'err' and "bold" white coloring when it's 'warn'.

Ah, right. Thanks for the reminder. You can add my RB to patch 2 as well.

Alex

Quoted 39 lines
Quoted 38 lines

Alex

Quoted 34 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -3
index aeeec211861c..e1b01554e323 100644
@@ -1092,16 +1092,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

#5 lore raw
In reply to Alex Deucher
Quoted 29 lines · Alex Deucher
Quoted 18 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.

The original commit also fixed a problem during resume from suspend to idle without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

Quoted 7 lines

Revert commit cf488dcd0ab7 ("drm/amd: Allow s0ix without BIOS support") to make it match the expected behavior again.

Quoted 7 lines

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

You'll need to revert d2a197a45daacd ("drm/amd: Only run s3 or s0ix if system is configured properly") as well, otherwise, we'll break runtime pm.

Alex

Quoted 36 lines

Alex

Quoted 34 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +6 -3
index aeeec211861c..e1b01554e323 100644
@@ -1092,16 +1092,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

#6 lore raw

[AMD Official Use Only - General]

Quoted 54 lines

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

Quoted 5 lines · Alex Deucher
Quoted 2 lines · Mario Limonciello

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

showed

Quoted 1 line
Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 6 lines
Quoted 6 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.

Quoted 6 lines
Quoted 6 lines

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.

The original commit also fixed a problem during resume from suspend to

idle

Quoted 4 lines
Quoted 4 lines

without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

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

support")

Quoted 4 lines
Quoted 4 lines

to make it match the expected behavior again.

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

Quoted 10 lines
Quoted 2 lines

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Quoted 4 lines

You'll need to revert d2a197a45daacd ("drm/amd: Only run s3 or s0ix if system is configured properly") as well, otherwise, we'll break runtime pm.

Can you elaborate more on your thought process? d2a197a45daacd was added in 5.18 and cf488dcd0ab7 was added in 6.3. I can't imagine runtime PM is broken the whole time on dGPUs.

Quoted 43 lines

Alex

Quoted 7 lines

Alex

Review

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

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

Quoted 4 lines

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

Quoted 4 lines

index aeeec211861c..e1b01554e323 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

Quoted 7 lines

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"

Quoted 1 line

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

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 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
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
Quoted 57 lines · Mario

[AMD Official Use Only - General]

Quoted 54 lines

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

Quoted 5 lines · Alex Deucher
Quoted 2 lines · Mario Limonciello

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

showed

Quoted 1 line
Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 6 lines
Quoted 6 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.

Quoted 6 lines
Quoted 6 lines

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.

The original commit also fixed a problem during resume from suspend to

idle

Quoted 4 lines
Quoted 4 lines

without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than Raven")

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

support")

Quoted 4 lines
Quoted 4 lines

to make it match the expected behavior again.

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

Quoted 10 lines
Quoted 2 lines

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Quoted 8 lines
Quoted 4 lines

You'll need to revert d2a197a45daacd ("drm/amd: Only run s3 or s0ix if system is configured properly") as well, otherwise, we'll break runtime pm.

Can you elaborate more on your thought process? d2a197a45daacd was added in 5.18 and cf488dcd0ab7 was added in 6.3. I can't imagine runtime PM is broken the whole time on dGPUs.

I tested this patch yesterday and it broke runtime pm because amdgpu_pmops_prepare() returned 1. I haven't delved into what condition broke. Reverting this patch restored runtime pm. This is a Threadripper box that only supports S3. The dGPUs were polaris and navi2x.

Alex

Quoted 44 lines
Quoted 44 lines

Alex

Quoted 7 lines

Alex

Review

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

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

Quoted 4 lines

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

Quoted 4 lines

index aeeec211861c..e1b01554e323 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

Quoted 7 lines

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"

Quoted 1 line

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

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 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
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

[AMD Official Use Only - General]

Quoted 81 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, June 1, 2023 11:15 AM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH v2 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 13 lines · Mario

[AMD Official Use Only - General]

Quoted 10 lines

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

On Wed, May 31, 2023 at 9:26 AM Alex Deucher

<[email protected]>

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines · wrote:
Quoted 1 line · Mario Limonciello
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

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

showed

Quoted 1 line
Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 3 lines
Quoted 3 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system

didn't

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 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.

The original commit also fixed a problem during resume from suspend

to

Quoted 3 lines
Quoted 3 lines

idle

Quoted 2 lines
Quoted 2 lines

without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than

Raven")

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

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

support")

Quoted 4 lines
Quoted 4 lines

to make it match the expected behavior again.

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

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

Quoted 12 lines
Quoted 12 lines

/amdgpu_acpi.c#L1060

Quoted 10 lines
Quoted 2 lines

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Quoted 6 lines
Quoted 4 lines

You'll need to revert d2a197a45daacd ("drm/amd: Only run s3 or s0ix if system is configured properly") as well, otherwise, we'll break runtime pm.

Can you elaborate more on your thought process? d2a197a45daacd was

added in 5.18

Quoted 1 line

and cf488dcd0ab7 was added in 6.3. I can't imagine runtime PM is broken

Quoted 9 lines

the whole time

Quoted 1 line

on dGPUs.

I tested this patch yesterday and it broke runtime pm because amdgpu_pmops_prepare() returned 1. I haven't delved into what condition broke. Reverting this patch restored runtime pm. This is a Threadripper box that only supports S3. The dGPUs were polaris and navi2x.

But runtime_suspend isn't supposed to run the prepare() callback AFACIT. SMART_PREPARE is only used for system wide suspend/resume.

Quoted 48 lines

Alex

Quoted 24 lines
Quoted 24 lines

Alex

Quoted 7 lines

Alex

Review

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

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

Quoted 4 lines

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

Quoted 4 lines

index aeeec211861c..e1b01554e323 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

Quoted 7 lines

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"

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

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

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
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

compiled with CONFIG_AMD_PMC.\n");

Quoted 11 lines
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

#9 lore raw
Quoted 94 lines · Mario

[AMD Official Use Only - General]

Quoted 81 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, June 1, 2023 11:15 AM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH v2 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 13 lines · Mario

[AMD Official Use Only - General]

Quoted 10 lines

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

On Wed, May 31, 2023 at 9:26 AM Alex Deucher

<[email protected]>

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines · wrote:
Quoted 1 line · Mario Limonciello
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

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

showed

Quoted 1 line
Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 3 lines
Quoted 3 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system

didn't

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 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.

The original commit also fixed a problem during resume from suspend

to

Quoted 3 lines
Quoted 3 lines

idle

Quoted 2 lines
Quoted 2 lines

without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than

Raven")

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

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

support")

Quoted 4 lines
Quoted 4 lines

to make it match the expected behavior again.

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

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

Quoted 12 lines
Quoted 12 lines

/amdgpu_acpi.c#L1060

Quoted 10 lines
Quoted 2 lines

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Quoted 6 lines
Quoted 4 lines

You'll need to revert d2a197a45daacd ("drm/amd: Only run s3 or s0ix if system is configured properly") as well, otherwise, we'll break runtime pm.

Can you elaborate more on your thought process? d2a197a45daacd was

added in 5.18

Quoted 1 line

and cf488dcd0ab7 was added in 6.3. I can't imagine runtime PM is broken

Quoted 9 lines

the whole time

Quoted 1 line

on dGPUs.

I tested this patch yesterday and it broke runtime pm because amdgpu_pmops_prepare() returned 1. I haven't delved into what condition broke. Reverting this patch restored runtime pm. This is a Threadripper box that only supports S3. The dGPUs were polaris and navi2x.

Quoted 2 lines

But runtime_suspend isn't supposed to run the prepare() callback AFACIT. SMART_PREPARE is only used for system wide suspend/resume.

Not sure what is happening then as amdgpu_acpi_is_s0ix_active() only affects amdgpu_pmops_prepare(), amdgpu_pmops_suspend(), and amdgpu_pmops_resume(). I'll try to trace what is going on.

Alex

Quoted 49 lines
Quoted 49 lines

Alex

Quoted 24 lines
Quoted 24 lines

Alex

Quoted 7 lines

Alex

Review

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

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

Quoted 4 lines

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

Quoted 4 lines

index aeeec211861c..e1b01554e323 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

Quoted 7 lines

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"

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

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

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
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

compiled with CONFIG_AMD_PMC.\n");

Quoted 11 lines
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

#10 lore raw
Quoted 97 lines · Alex Deucher
Quoted 94 lines · Mario

[AMD Official Use Only - General]

Quoted 90 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, June 1, 2023 11:15 AM
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Rafael Ávila de Espíndola <[email protected]>
Subject: Re: [PATCH v2 1/2] drm/amd: Disallow s0ix without BIOS support again

Quoted 13 lines · Mario

[AMD Official Use Only - General]

Quoted 10 lines

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

On Wed, May 31, 2023 at 9:26 AM Alex Deucher

<[email protected]>

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines · wrote:
Quoted 1 line · Mario Limonciello
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

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

showed

Quoted 1 line
Quoted 1 line

improvements to power consumption over suspend when s0ix wasn't

enabled in

Quoted 3 lines
Quoted 3 lines

BIOS and the system didn't support S3.

This patch however was misguided because the reason the system

didn't

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 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.

The original commit also fixed a problem during resume from suspend

to

Quoted 3 lines
Quoted 3 lines

idle

Quoted 2 lines
Quoted 2 lines

without hardware support, but this is no longer necessary with commit ca4751866397 ("drm/amd: Don't allow s0ix on APUs older than

Raven")

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

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

support")

Quoted 4 lines
Quoted 4 lines

to make it match the expected behavior again.

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

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

Quoted 12 lines
Quoted 12 lines

/amdgpu_acpi.c#L1060

Quoted 10 lines
Quoted 2 lines

Patch 1 is:

Patch 2 seems a bit much, but I could be convinced if you think it will actually help more than a warn would. Users already assume warn is a kernel crash. I'm not sure the average user makes a distinction between warn and err.

Quoted 6 lines
Quoted 4 lines

You'll need to revert d2a197a45daacd ("drm/amd: Only run s3 or s0ix if system is configured properly") as well, otherwise, we'll break runtime pm.

Can you elaborate more on your thought process? d2a197a45daacd was

added in 5.18

Quoted 1 line

and cf488dcd0ab7 was added in 6.3. I can't imagine runtime PM is broken

the whole time

Quoted 1 line

on dGPUs.

I tested this patch yesterday and it broke runtime pm because amdgpu_pmops_prepare() returned 1. I haven't delved into what condition broke. Reverting this patch restored runtime pm. This is a Threadripper box that only supports S3. The dGPUs were polaris and navi2x.

Quoted 6 lines
Quoted 2 lines

But runtime_suspend isn't supposed to run the prepare() callback AFACIT. SMART_PREPARE is only used for system wide suspend/resume.

Not sure what is happening then as amdgpu_acpi_is_s0ix_active() only affects amdgpu_pmops_prepare(), amdgpu_pmops_suspend(), and amdgpu_pmops_resume(). I'll try to trace what is going on.

Nevermind, now I can't repro it.

Alex

Quoted 52 lines

Alex

Quoted 49 lines
Quoted 49 lines

Alex

Quoted 24 lines
Quoted 24 lines

Alex

Quoted 7 lines

Alex

Review

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

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

Quoted 4 lines

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

Quoted 4 lines

index aeeec211861c..e1b01554e323 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -0
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct

amdgpu_device *adev)

Quoted 7 lines

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

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"

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

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

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
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

compiled with CONFIG_AMD_PMC.\n");

Quoted 11 lines
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