Commit 924dda02 authored by Samuel Zhang's avatar Samuel Zhang Committed by Mario Limonciello
Browse files

drm/amdgpu: move GTT to shmem after eviction for hibernation



When hibernate with data center dGPUs, huge number of VRAM BOs evicted
to GTT and takes too much system memory. This will cause hibernation
fail due to insufficient memory for creating the hibernation image.

Move GTT BOs to shmem in KMD, then shmem to swap disk in kernel
hibernation code to make room for hibernation image.

Signed-off-by: default avatarSamuel Zhang <guoqing.zhang@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20250710062313.3226149-3-guoqing.zhang@amd.com


Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
parent 40b6a946
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -5029,11 +5029,19 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
		return 0;

	ret = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
	if (ret)
	if (ret) {
		dev_warn(adev->dev, "evicting device resources failed\n");
		return ret;
	}

	if (adev->in_s4) {
		ret = ttm_device_prepare_hibernation(&adev->mman.bdev);
		if (ret)
			dev_err(adev->dev, "prepare hibernation failed, %d\n", ret);
	}
	return ret;
}

/*
 * Suspend & resume.
 */