Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH 0/3] reduce system memory requirement for hibernation
@ 2025-06-30 10:41 Samuel Zhang
  2025-06-30 10:41 ` [PATCH 1/3] drm/amdgpu: move GTT to SHM after eviction " Samuel Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Samuel Zhang @ 2025-06-30 10:41 UTC (permalink / raw)
  To: rafael, len.brown, pavel, alexander.deucher, christian.koenig,
	mario.limonciello, lijo.lazar
  Cc: victor.zhao, haijun.chang, Qing.Ma, amd-gfx, dri-devel, linux-pm,
	linux-kernel, Samuel Zhang

Modern data center dGPUs are usually equipped with very large VRAM. On
server with such dGPUs(192GB VRAM * 8) and 2TB system memory, hibernate
will fail due to no enough free memory.

The root cause is that during hibernation all VRAM memory get evicted to
GTT or shmem. In both case, it is in system memory and kernel will try to 
copy the pages to hibernation image. In the worst case, this causes 2 
copies of VRAM memory in system memory, 2TB is not enough for the 
hibernation image. 192GB * 8 * 2 = 3TB > 2TB.

The fix includes following 2 changes. With 2 changes, there's much less 
pages needed to be copied to hibernate image and hibernation can succeed.
1. move GTT to shmem after evicting VRAM. then the GTT pages can be freed.
2. force write shmem pages to swap disk and free shmem pages.

After swapout GTT to shmem in hibernation prepare stage, swapin and 
restore BOs in thaw stage takes lots of time(50 mintues observed for 
8 dGPUs). And it's not necessary since the follow-up hibernate stages do 
not use GPU for hibernation successful case. The third patch is just skip 
the BOs restore in thaw stage to reduce the hibernation time.

Samuel Zhang (3):
  drm/amdgpu: move GTT to SHM after eviction for hibernation
  PM: hibernate: shrink shmem pages after dev_pm_ops.prepare()
  drm/amdgpu: skip kfd resume_process for dev_pm_ops.thaw()

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 13 ++++++++++++-
 drivers/gpu/drm/ttm/ttm_resource.c         | 18 ++++++++++++++++++
 include/drm/ttm/ttm_resource.h             |  1 +
 kernel/power/hibernate.c                   | 13 +++++++++++++
 6 files changed, 47 insertions(+), 2 deletions(-)

-- 
2.43.5


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-07-04 10:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 10:41 [PATCH 0/3] reduce system memory requirement for hibernation Samuel Zhang
2025-06-30 10:41 ` [PATCH 1/3] drm/amdgpu: move GTT to SHM after eviction " Samuel Zhang
2025-06-30 11:54   ` Christian König
     [not found]     ` <DM4PR12MB5937FFB3E121E489A261785DE541A@DM4PR12MB5937.namprd12.prod.outlook.com>
2025-07-01  8:22       ` Christian König
2025-07-02  7:28         ` Samuel Zhang
2025-07-02  7:48           ` Christian König
2025-06-30 10:41 ` [PATCH 2/3] PM: hibernate: shrink shmem pages after dev_pm_ops.prepare() Samuel Zhang
2025-06-30 20:21   ` Rafael J. Wysocki
2025-06-30 10:41 ` [PATCH 3/3] drm/amdgpu: skip kfd resume_process for dev_pm_ops.thaw() Samuel Zhang
2025-06-30 11:58   ` Christian König
     [not found]     ` <8eb1700d-4d60-4a1e-9d09-718f65baaf1e@amd.com>
2025-07-01  8:32       ` Christian König
2025-07-01 16:07         ` Alex Deucher
2025-07-02  7:23           ` Sam
2025-07-02 13:54             ` Alex Deucher
2025-07-02 14:07               ` Lazar, Lijo
2025-07-04 10:24                 ` Zhang, GuoQing (Sam)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox