[PATCH v2 2/3] drm/amd: Move evict resources suspend step to prepare()
Deucher, Alexander
Alexander.Deucher at amd.com
Tue Oct 3 12:58:04 UTC 2023
[AMD Official Use Only - General]
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Mario
> Limonciello
> Sent: Monday, October 2, 2023 6:45 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Wentland, Harry <Harry.Wentland at amd.com>; Limonciello, Mario
> <Mario.Limonciello at amd.com>
> Subject: [PATCH v2 2/3] drm/amd: Move evict resources suspend step to
> prepare()
>
> If the system is under high memory pressure, the resources may need to be
> evicted into swap instead. If the storage backing for swap is offlined during
> the suspend() step then such a call may fail.
>
> So instead move this step into prepare(), while leaving all other steps that put
> the GPU into a low power state in suspend().
>
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index c41d69e7a8f5..bb0e753fb6f8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4276,6 +4276,11 @@ int amdgpu_device_prepare(struct drm_device
> *dev)
> if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> return 0;
>
> + /* Evict the majority of BOs before grabbing the full access */
> + r = amdgpu_device_evict_resources(adev);
> + if (r)
> + return r;
> +
> return 0;
> }
>
> @@ -4297,13 +4302,6 @@ int amdgpu_device_suspend(struct drm_device
> *dev, bool fbcon)
> if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> return 0;
>
> - adev->in_suspend = true;
This shouldn't be dropped.
Alex
> -
> - /* Evict the majority of BOs before grabbing the full access */
> - r = amdgpu_device_evict_resources(adev);
> - if (r)
> - return r;
> -
> if (amdgpu_sriov_vf(adev)) {
> amdgpu_virt_fini_data_exchange(adev);
> r = amdgpu_virt_request_full_gpu(adev, false);
> --
> 2.34.1
More information about the amd-gfx
mailing list