Skip to contentSkip to conversation

drm/amdgpu: explicitly check for s0ix when evicting resources

PATCH In review Mario Limonciello 4 participants 7 messages Jan 3, 2022 – Jan 4, 2022

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

PATCH 1/2 drm/amdgpu: explicitly check for s0ix when evicting resources

This codepath should be running in both s0ix and s3, but only does currently because s3 and s0ix are both set in the s0ix case.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index ce93a304292c..412f377f80b1 100644
@@ -3956,8 +3956,8 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
  */
 static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
 {
-	/* No need to evict vram on APUs for suspend to ram */
-	if (adev->in_s3 && (adev->flags & AMD_IS_APU))
+	/* No need to evict vram on APUs for suspend to ram or s2idle */
+	if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU))
 		return;
 
 	if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 drm/amdgpu: don't set s3 and s0ix at the same time

This makes it clearer which codepaths are in use specifically in one state or the other.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -2
index db2a9dfd5918..413fecc89e6c 100644
@@ -2165,9 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
 
 	if (amdgpu_acpi_is_s0ix_active(adev))
 		adev->in_s0ix = true;
-	adev->in_s3 = true;
+	else
+		adev->in_s3 = true;
 	r = amdgpu_device_suspend(drm_dev, true);
-	adev->in_s3 = false;
 	if (r)
 		return r;
 	if (!adev->in_s0ix)
@@ -2188,6 +2188,8 @@ static int amdgpu_pmops_resume(struct device *dev)
 	r = amdgpu_device_resume(drm_dev, true);
 	if (amdgpu_acpi_is_s0ix_active(adev))
 		adev->in_s0ix = false;
+	else
+		adev->in_s3 = false;
 	return r;
 }
 
Signature · 1 line
2.25.1
#2 lore raw

RE: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

[AMD Official Use Only]

Series is acked-by: Evan Quan <[email protected]>

Quoted 46 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello
Sent: Monday, January 3, 2022 11:23 PM
To: [email protected]
Cc: Limonciello, Mario <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

This makes it clearer which codepaths are in use specifically in one state or the other.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -2
index db2a9dfd5918..413fecc89e6c 100644
@@ -2165,9 +2165,9 @@ static int amdgpu_pmops_suspend(struct device
 *dev)
 
 	if (amdgpu_acpi_is_s0ix_active(adev))
 		adev->in_s0ix = true;
-	adev->in_s3 = true;
+	else
+		adev->in_s3 = true;
 	r = amdgpu_device_suspend(drm_dev, true);
-	adev->in_s3 = false;
 	if (r)
 		return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
 	if (!adev->in_s0ix)
@@ -2188,6 +2188,8 @@ static int amdgpu_pmops_resume(struct device
 *dev)
 	r = amdgpu_device_resume(drm_dev, true);
 	if (amdgpu_acpi_is_s0ix_active(adev))
 		adev->in_s0ix = false;
+	else
+		adev->in_s3 = false;
 	return r;
 }
 
--

2.25.1

#3 lore raw

Re: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

In reply to Mario Limonciello

[AMD Official Use Only]

I don't think this will work properly. The in_s3 flag was mainly for runtime pm vs system suspend. I'm not sure if in_s0ix is properly handled everywhere we check in_s3.

Alex

________________________________
From: amd-gfx <[email protected]> on behalf of Mario Limonciello <[email protected]>
Sent: Monday, January 3, 2022 10:23 AM
To: [email protected] <[email protected]>
Cc: Limonciello, Mario <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

This makes it clearer which codepaths are in use specifically in one state or the other.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -2
index db2a9dfd5918..413fecc89e6c 100644
@@ -2165,9 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
 
         if (amdgpu_acpi_is_s0ix_active(adev))
                 adev->in_s0ix = true;
-       adev->in_s3 = true;
+       else
+               adev->in_s3 = true;
         r = amdgpu_device_suspend(drm_dev, true);
-       adev->in_s3 = false;
         if (r)
                 return r;
         if (!adev->in_s0ix)
@@ -2188,6 +2188,8 @@ static int amdgpu_pmops_resume(struct device *dev)
         r = amdgpu_device_resume(drm_dev, true);
         if (amdgpu_acpi_is_s0ix_active(adev))
                 adev->in_s0ix = false;
+       else
+               adev->in_s3 = false;
         return r;
 }
 

--
2.25.1

#4 lore raw

RE: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

[AMD Official Use Only]

Maybe it was used more widely previously?
The only place that I found it in use was amdgpu_device_evict_resources.

From: Deucher, Alexander <[email protected]>
Sent: Tuesday, January 4, 2022 11:24
To: Limonciello, Mario <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

[AMD Official Use Only]

I don't think this will work properly. The in_s3 flag was mainly for runtime pm vs system suspend. I'm not sure if in_s0ix is properly handled everywhere we check in_s3.

Alex

________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Mario Limonciello <[email protected]<mailto:[email protected]>>
Sent: Monday, January 3, 2022 10:23 AM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Limonciello, Mario <[email protected]<mailto:[email protected]>>
Subject: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

This makes it clearer which codepaths are in use specifically in one state or the other.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -2
index db2a9dfd5918..413fecc89e6c 100644
@@ -2165,9 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
 
         if (amdgpu_acpi_is_s0ix_active(adev))
                 adev->in_s0ix = true;
-       adev->in_s3 = true;
+       else
+               adev->in_s3 = true;
         r = amdgpu_device_suspend(drm_dev, true);
-       adev->in_s3 = false;
         if (r)
                 return r;
         if (!adev->in_s0ix)
@@ -2188,6 +2188,8 @@ static int amdgpu_pmops_resume(struct device *dev)
         r = amdgpu_device_resume(drm_dev, true);
         if (amdgpu_acpi_is_s0ix_active(adev))
                 adev->in_s0ix = false;
+       else
+               adev->in_s3 = false;
         return r;
 }
 

--
2.25.1

#5 lore raw

Re: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

Quoted 18 lines · Mario

[AMD Official Use Only]

Maybe it was used more widely previously?

The only place that I found it in use was amdgpu_device_evict_resources.

From: Deucher, Alexander <[email protected]>
Sent: Tuesday, January 4, 2022 11:24
To: Limonciello, Mario <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

Quoted 6 lines

[AMD Official Use Only]

I don't think this will work properly. The in_s3 flag was mainly for runtime pm vs system suspend. I'm not sure if in_s0ix is properly handled everywhere we check in_s3.

In that case, Acked-by: Alex Deucher <[email protected]>

Quoted 51 lines

Alex

________________________________

From: amd-gfx <[email protected]> on behalf of Mario Limonciello <[email protected]>
Sent: Monday, January 3, 2022 10:23 AM
To: [email protected] <[email protected]>
Cc: Limonciello, Mario <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: don't set s3 and s0ix at the same time

This makes it clearer which codepaths are in use specifically in one state or the other.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -3
index db2a9dfd5918..413fecc89e6c 100644
@@ -2165,9 +2165,9 @@ static int amdgpu_pmops_suspend(struct device *dev)
 
         if (amdgpu_acpi_is_s0ix_active(adev))
                 adev->in_s0ix = true;
-       adev->in_s3 = true;
+       else
+               adev->in_s3 = true;
         r = amdgpu_device_suspend(drm_dev, true);
-       adev->in_s3 = false;
         if (r)
                 return r;
         if (!adev->in_s0ix)
@@ -2188,6 +2188,8 @@ static int amdgpu_pmops_resume(struct device *dev)
         r = amdgpu_device_resume(drm_dev, true);
         if (amdgpu_acpi_is_s0ix_active(adev))
                 adev->in_s0ix = false;
+       else
+               adev->in_s3 = false;
         return r;
 }
 
--

2.25.1

maintainer Reviewed-by on v1 1/2
#6 lore raw
In reply to Mario Limonciello

[Public]

________________________________
From: amd-gfx <[email protected]> on behalf of Mario Limonciello <[email protected]>
Sent: Monday, January 3, 2022 10:23 AM
To: [email protected] <[email protected]>
Cc: Limonciello, Mario <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: explicitly check for s0ix when evicting resources

This codepath should be running in both s0ix and s3, but only does currently because s3 and s0ix are both set in the s0ix case.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index ce93a304292c..412f377f80b1 100644
@@ -3956,8 +3956,8 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
  */
 static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
 {
-       /* No need to evict vram on APUs for suspend to ram */
-       if (adev->in_s3 && (adev->flags & AMD_IS_APU))
+       /* No need to evict vram on APUs for suspend to ram or s2idle */
+       if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU))
                 return;
 
         if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))

--
2.25.1