AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] Evict VRAM after processes are frozen
@ 2025-05-01 21:17 Mario Limonciello
  2025-05-01 21:17 ` [RFC 1/2] PM: Add suspend and hibernate notifications for after freeze Mario Limonciello
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Mario Limonciello @ 2025-05-01 21:17 UTC (permalink / raw)
  To: Alex Deucher, Rafael J . Wysocki
  Cc: Christian König, open list:RADEON and AMDGPU DRM DRIVERS,
	open list:DRM DRIVERS,
	open list:HIBERNATION (aka Software Suspend, aka swsusp),
	Mario Limonciello

From: Mario Limonciello <mario.limonciello@amd.com>

As part of the suspend and hibernate sequences devices supported
by amdgpu will have VRAM evicted.  This has been littered with problems
in the past, and now it is called strategically at multiple times
during power management sequences.

Most recently there were a number of issues reported that were root caused
to physical memory pressure at suspend time where VRAM couldn't be evicted.
A new call was introduced using a PM notifier before swap was turned off
so that even if there are physical memory pressures VRAM could still be
evicted into swap.

This helped, but users using older systemd noted that this could lead to a
deadlock.  This is because user processes aren't frozen by older versions
of systemd and thus if a game is running it could potentially be creating
BOs during the eviction thus preventing eviction from ever completing.

This isn't an issue with newer systemd because it uses cgroup freezing
to freeze user processes. Nonetheless this isn't a good behavior to rely
upon for userspace, so this series aims to solve the problem in another way.

Introduce new PM notifier calls after "prepare" notifier is done AND after
tasks have been frozen.  amdgpu listens to these PM notifier calls and
will run the first eviction at this time.

Mario Limonciello (2):
  PM: Add suspend and hibernate notifications for after freeze
  drm/amd: Use suspend and hibernate post freeze notifications

 Documentation/driver-api/pm/notifiers.rst  | 19 ++++++++++++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  4 ++--
 include/linux/suspend.h                    | 14 ++++++++------
 kernel/power/hibernate.c                   |  9 +++++++--
 kernel/power/suspend.c                     | 13 +++++++++----
 5 files changed, 42 insertions(+), 17 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2025-05-07 19:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 21:17 [RFC 0/2] Evict VRAM after processes are frozen Mario Limonciello
2025-05-01 21:17 ` [RFC 1/2] PM: Add suspend and hibernate notifications for after freeze Mario Limonciello
2025-05-02 16:37   ` Mario Limonciello
2025-05-01 21:17 ` [RFC 2/2] drm/amd: Use suspend and hibernate post freeze notifications Mario Limonciello
2025-05-07 19:14   ` Rafael J. Wysocki
2025-05-07 19:17     ` Mario Limonciello
2025-05-07 19:39       ` Rafael J. Wysocki
2025-05-07 19:42         ` Alex Deucher
2025-05-07 19:45         ` Mario Limonciello
2025-05-07 19:51           ` Rafael J. Wysocki
2025-05-02 14:47 ` [RFC 0/2] Evict VRAM after processes are frozen Christian König

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