Linux Power Management development
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Mario Limonciello <superm1@kernel.org>, dwmw2@infradead.org
Cc: mario.limonciello@amd.com, rafael@kernel.org,
	len.brown@intel.com, pavel@kernel.org,
	gregkh@linuxfoundation.org, dakr@kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	christian.koenig@amd.com, linux-pm@vger.kernel.org,
	kexec@lists.infradead.org
Subject: Re: [PATCH] PM: Restrict swap use to later in the suspend sequence
Date: Mon, 23 Jun 2025 11:23:43 +0800	[thread overview]
Message-ID: <aFjIv5OqUyiSNrRi@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20250613214413.4127087-1-superm1@kernel.org>

On 06/13/25 at 04:43pm, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> Currently swap is restricted before drivers have had a chance to do their
> prepare() PM callbacks. Restricting swap this early means that if a driver
> needs to evict some content from memory into sawp in it's prepare callback
> it won't be able to.
> 
> On AMD dGPUs this can lead to failed suspends under memory pressure
> situations as all VRAM must be evicted to system memory or swap.
> 
> Move the swap restriction to right after all devices have had a chance to
> do the prepare() callback.  If there is any problem with the sequence,
> restore swap in the appropriate dpm resume callbacks or error handling
> paths.
> 
> Closes: https://github.com/ROCm/ROCK-Kernel-Driver/issues/174
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/base/power/main.c | 5 ++++-
>  include/linux/suspend.h   | 5 +++++
>  kernel/kexec_core.c       | 1 +
>  kernel/power/hibernate.c  | 3 ---
>  kernel/power/power.h      | 5 -----
>  kernel/power/suspend.c    | 3 +--
>  6 files changed, 11 insertions(+), 11 deletions(-)
> 
......snip...
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 9c59fa480b0b6..3a9a9f240dbc9 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -1136,6 +1136,7 @@ int kernel_kexec(void)
>   Resume_devices:
>  		dpm_resume_end(PMSG_RESTORE);
>   Resume_console:
> +		pm_restore_gfp_mask();
>  		console_resume_all();
>  		thaw_processes();
>   Restore_console:

This change is inside KEXEC_JUMP scope, let David know this because he
ever tested and made change for KEXEC_JUMP.
......


  parent reply	other threads:[~2025-06-23  3:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 21:43 [PATCH] PM: Restrict swap use to later in the suspend sequence Mario Limonciello
2025-06-23  1:29 ` Mario Limonciello
2025-06-23  3:23 ` Baoquan He [this message]
2025-06-23  4:58   ` David Woodhouse
2025-06-23  6:25 ` Lucian Langa
2025-06-26 18:41   ` Rafael J. Wysocki

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=aFjIv5OqUyiSNrRi@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kexec@lists.infradead.org \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=superm1@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