Skip to contentSkip to conversation

drm/amdgpu: remove evict_resource for sriov when suspend.

PATCH In review Shikang Fan 3 participants 4 messages Dec 5, 2022 – Dec 6, 2022

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

PATCH 1/1 drm/amdgpu: remove evict_resource for sriov when suspend.

- There is no need to evict resources from vram to sram for sriov because GPU is still powered on. And evicet is taking too much time that would cause full access mode timedout in multi-vf mode.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -3
index 818fa72c670d..55fe425fbe6d 100644
@@ -4135,9 +4135,11 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
 	if (!adev->in_s0ix)
 		amdgpu_amdkfd_suspend(adev, adev->in_runpm);
 
-	r = amdgpu_device_evict_resources(adev);
-	if (r)
-		return r;
+	if (!amdgpu_sriov_vf(adev)) {
+		r = amdgpu_device_evict_resources(adev);
+		if (r)
+			return r;
+	}
 
 	amdgpu_fence_driver_hw_fini(adev);
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Am 05.12.22 um 09:47 schrieb Shikang Fan:

Quoted 3 lines

- There is no need to evict resources from vram to sram for sriov because GPU is still powered on. And evicet is taking too much time that would cause full access mode timedout in multi-vf mode.

Well big NAK to this!

The suspend is usually done to migrating the virtual machine to a different hw instance. Because of this the content of VRAM is usually destroyed.

Regards,
Christian.

Quoted 25 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -3
index 818fa72c670d..55fe425fbe6d 100644
@@ -4135,9 +4135,11 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
  	if (!adev->in_s0ix)
  		amdgpu_amdkfd_suspend(adev, adev->in_runpm);
 
-	r = amdgpu_device_evict_resources(adev);
-	if (r)
-		return r;
+	if (!amdgpu_sriov_vf(adev)) {
+		r = amdgpu_device_evict_resources(adev);
+		if (r)
+			return r;
+	}
 
  	amdgpu_fence_driver_hw_fini(adev);
 
#2 lore raw

[AMD Official Use Only - General]

I agree with Christian . Although on some hypervisior with live migration support , there will be specific API between OS and PF driver to handle the FB content save/restore for VF, in this case , guest side save/restore is not necessary. On other hypervisior without the live migration(like KVM for now) , it will depends on the guests driver do the save/restore itself on suspend/resume call back.

Regards
Shaoyun.liu

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Monday, December 5, 2022 5:43 AM
To: Fan, Shikang <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: remove evict_resource for sriov when suspend.

Am 05.12.22 um 09:47 schrieb Shikang Fan:

Quoted 3 lines

- There is no need to evict resources from vram to sram for sriov because GPU is still powered on. And evicet is taking too much time that would cause full access mode timedout in multi-vf mode.

Well big NAK to this!

The suspend is usually done to migrating the virtual machine to a different hw instance. Because of this the content of VRAM is usually destroyed.

Regards,
Christian.

Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -3
index 818fa72c670d..55fe425fbe6d 100644
@@ -4135,9 +4135,11 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
      if (!adev->in_s0ix)
              amdgpu_amdkfd_suspend(adev, adev->in_runpm);
 
-     r = amdgpu_device_evict_resources(adev);
-     if (r)
-             return r;
+     if (!amdgpu_sriov_vf(adev)) {
+             r = amdgpu_device_evict_resources(adev);
+             if (r)
+                     return r;
+     }
 
      amdgpu_fence_driver_hw_fini(adev);
 
#3 lore raw

[AMD Official Use Only - General]

Hi Shaoyun and Christian,

Thank you for your comments! We indeed did not consider the live migration case when we tried to fix this and we shall come up with other methods for our issue.

Best regards,
Shikang.

-----Original Message-----
From: Liu, Shaoyun <[email protected]>
Sent: Tuesday, December 6, 2022 4:26 AM
To: Koenig, Christian <[email protected]>; Fan, Shikang <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: remove evict_resource for sriov when suspend.

[AMD Official Use Only - General]

I agree with Christian . Although on some hypervisior with live migration support , there will be specific API between OS and PF driver to handle the FB content save/restore for VF, in this case , guest side save/restore is not necessary. On other hypervisior without the live migration(like KVM for now) , it will depends on the guests driver do the save/restore itself on suspend/resume call back.

Regards
Shaoyun.liu

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Monday, December 5, 2022 5:43 AM
To: Fan, Shikang <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: remove evict_resource for sriov when suspend.

Am 05.12.22 um 09:47 schrieb Shikang Fan:

Quoted 3 lines

- There is no need to evict resources from vram to sram for sriov because GPU is still powered on. And evicet is taking too much time that would cause full access mode timedout in multi-vf mode.

Well big NAK to this!

The suspend is usually done to migrating the virtual machine to a different hw instance. Because of this the content of VRAM is usually destroyed.

Regards,
Christian.

Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -3
index 818fa72c670d..55fe425fbe6d 100644
@@ -4135,9 +4135,11 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
      if (!adev->in_s0ix)
              amdgpu_amdkfd_suspend(adev, adev->in_runpm);
 
-     r = amdgpu_device_evict_resources(adev);
-     if (r)
-             return r;
+     if (!amdgpu_sriov_vf(adev)) {
+             r = amdgpu_device_evict_resources(adev);
+             if (r)
+                     return r;
+     }
 
      amdgpu_fence_driver_hw_fini(adev);