From: Mario Limonciello <superm1@kernel.org>
To: Alex Deucher <alexander.deucher@amd.com>,
"Rafael J . Wysocki" <rafael@kernel.org>
Cc: "Christian König" <christian.koenig@amd.com>,
amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM
DRIVERS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS),
linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software
Suspend, aka swsusp)),
"Mario Limonciello" <mario.limonciello@amd.com>
Subject: [RFC 0/2] Evict VRAM after processes are frozen
Date: Thu, 1 May 2025 16:17:31 -0500 [thread overview]
Message-ID: <20250501211734.2434369-1-superm1@kernel.org> (raw)
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
next reply other threads:[~2025-05-01 21:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-01 21:17 Mario Limonciello [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250501211734.2434369-1-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox