From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: run prepare-phase eviction for hibernation on APUs
Date: Fri, 04 Dec 2026 21:27:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-250694@kernel.org> (raw)
In-Reply-To: <20261204-amdgpu-apu-s4-prepare-v1-1-1658fb81d9c9@amd.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amdgpu: unpaired prepare in amdgpu_pmops_prepare() during
hybrid sleep
- [Low] drm/amdgpu: trailing comma in commit message Fixes trailer
--
commit f21df76d47cb0f407cd0216cb0a996e7fd62337d
Author: Mario Limonciello <mario.limonciello@amd.com>
> drm/amdgpu: run prepare-phase eviction for hibernation on APUs
>
> amdgpu_pmops_prepare() returns early when neither s0ix nor s3 is
> active. On an APU both helpers test pm_suspend_target_state, which is
> only set by suspend_devices_and_enter() and so is PM_SUSPEND_ON
> throughout hibernation_snapshot(). As a result amdgpu_device_prepare()
> is skipped for hibernation on APUs, and with it the VRAM eviction and
> ttm_device_prepare_hibernation() that the PM notifier sets in_s4 up for.
>
> The eviction instead happens from amdgpu_pmops_freeze(), after
> hibernate_preallocate_memory() has already sized the image and after
> pm_restrict_gfp_mask() has made it impossible to swap anything out.
> Everything evicted into shmem/TTM pools at that point lands in the
> image unaccounted for, and under memory pressure snapshot creation
> fails:
>
> PM: hibernation: Not enough free memory for image creation
> PM: hibernation: Error -12 creating image
>
> Discrete GPUs are unaffected as amdgpu_acpi_is_s3_active() is
> unconditionally true for them.
>
> Don't take the early return when adev->in_s4 is set, so the eviction
> runs in the prepare phase, before the image is preallocated.
>
> Fixes: 06f2dcc241e7 ("drm/amdgpu: fix pm notifier handling"),
> Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/4711
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
[Severity: Low]
There is a stray trailing comma on the Fixes tag. Should it be:
Fixes: 06f2dcc241e7 ("drm/amdgpu: fix pm notifier handling")
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index d2db20c172c69..5d081bbe52260 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2626,9 +2626,11 @@ static int amdgpu_pmops_prepare(struct device *dev)
> return 1;
>
> /* if we will not support s3 or s2i for the device
> - * then skip suspend
> + * then skip suspend, but not for hibernation: resources need to be
> + * evicted here, before the hibernation image is sized.
> */
> - if (!amdgpu_acpi_is_s0ix_active(adev) &&
> + if (!adev->in_s4 &&
> + !amdgpu_acpi_is_s0ix_active(adev) &&
> !amdgpu_acpi_is_s3_active(adev))
> return 1;
[Severity: Medium]
Can this run amdgpu_device_prepare() unpaired during hybrid sleep?
During HIBERNATION_SUSPEND, amdgpu_pmops_thaw() resumes the GPU and clears
adev->in_suspend while adev->in_s4 remains true until PM_POST_HIBERNATION.
power_down() then calls suspend_devices_and_enter(), which invokes
amdgpu_pmops_prepare().
On an APU where neither S0ix nor S3 is supported for the target sleep state,
!adev->in_s4 is false so amdgpu_pmops_prepare() falls through to
amdgpu_device_prepare(), while amdgpu_pmops_suspend() and
amdgpu_pmops_resume() skip suspend and resume.
This triggers a second VRAM eviction and ttm_device_prepare_hibernation()
while pm_restrict_gfp_mask() is still active. On pre-Raven UVD APUs with
active UVD handles it also leaks adev->uvd.inst[j].saved_bo allocated in
amdgpu_uvd_prepare_suspend(), since no matching resume or complete frees it.
Gating the S4 check on !pm_suspend_in_progress() would keep
amdgpu_pmops_prepare() consistent with amdgpu_pmops_suspend() and
amdgpu_pmops_resume() during hybrid sleep.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-amdgpu-apu-s4-prepare-v1-1-1658fb81d9c9@amd.com?part=1
next prev parent reply other threads:[~2026-12-04 21:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 21:07 [PATCH] drm/amdgpu: run prepare-phase eviction for hibernation on APUs Mario Limonciello
2026-12-04 21:27 ` sashiko-bot [this message]
2026-12-04 21:42 ` Alex Deucher
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=sashiko-outbox-250694@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=mario.limonciello@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.