From: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: mario.limonciello@amd.com, airlied@gmail.com,
alexander.deucher@amd.com, christian.koenig@amd.com,
dakr@kernel.org, gregkh@linuxfoundation.org, lenb@kernel.org,
pavel@kernel.org, simona@ffwll.ch,
Muhammad Usama Anjum <usama.anjum@collabora.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-pm@vger.kernel.org
Subject: Re: [RFC 3/3] drm/amd: Return -EBUSY for amdgpu_pmops_thaw() on success
Date: Mon, 20 Oct 2025 13:32:00 -0500 [thread overview]
Message-ID: <aec8fc6c-3f9f-4ec1-a929-7a0be6026a3d@kernel.org> (raw)
In-Reply-To: <CAJZ5v0gT9BG5QPcwg6jJ1Jghny2YxC9_HY542LTBy-aVc_2T_w@mail.gmail.com>
On 10/20/2025 12:39 PM, Rafael J. Wysocki wrote:
> On Mon, Oct 20, 2025 at 7:28 PM Mario Limonciello (AMD) (kernel.org)
> <superm1@kernel.org> wrote:
>>
>>
>>
>> On 10/20/2025 12:21 PM, Rafael J. Wysocki wrote:
>>> On Mon, Oct 20, 2025 at 6:53 PM Mario Limonciello (AMD)
>>> <superm1@kernel.org> wrote:
>>>>
>>>> From: Mario Limonciello <mario.limonciello@amd.com>
>>>>
>>>> The PM core should be notified that thaw was skipped for the device
>>>> so that if it's tried to be resumed (such as an aborted hibernate)
>>>> that it gets another chance to resume.
>>>>
>>>> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>>>> ---
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>>> index 61268aa82df4d..d40af069f24dd 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>>> @@ -2681,7 +2681,7 @@ static int amdgpu_pmops_thaw(struct device *dev)
>>>>
>>>> /* do not resume device if it's normal hibernation */
>>>> if (!pm_hibernate_is_recovering() && !pm_hibernation_mode_is_suspend())
>>>> - return 0;
>>>> + return -EBUSY;
>>>
>>> So that's why you need the special handling of -EBUSY in the previous patch.
>>
>> Yup.
>>
>>>
>>> I think that you need to save some state in this driver and then use
>>> it in subsequent callbacks instead of hacking the core to do what you
>>> want.
>>>
>>
>> The problem is the core decides "what" to call and more importantly
>> "when" to call it.
>>
>> IE if the core thinks that something is thawed it will never call
>> resume, and that's why you end up in a bad place with Muhammad's
>> cancellation series and why I proposed this one to discuss.
>>
>> We could obviously go back to dropping this case entirely:
>>
>> if (!pm_hibernate_is_recovering() && !pm_hibernation_mode_is_suspend())
>>
>> But then the display turns on at thaw(), you do an unnecessary resource
>> eviction, it takes a lot longer if you have a ton of VRAM etc.
>
> The cancellation series is at odds with this code path AFAICS because
> what if hibernation is canceled after the entire thaw transition?
Muhammad - did you test that specific timing of cancelling the hibernate?
>
> Some cleanup would need to be done before thawing user space I suppose.
I agree; I think that series would need changes for it.
But if you put that series aside, I think this one still has some merit
on it's own. If another driver aborted the hibernate, I think the same
thing could happen if it happened to run before amdgpu's device thaw().
That series just exposed a very "easy" way to reproduce this issue.
next prev parent reply other threads:[~2025-10-20 18:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 16:50 [RFC 0/3] Fixups for cancelled hibernate Mario Limonciello (AMD)
2025-10-20 16:50 ` [RFC 1/3] PM: Mark device as suspended if it failed to resume Mario Limonciello (AMD)
2025-10-20 16:58 ` Muhammad Usama Anjum
2025-10-20 17:15 ` Rafael J. Wysocki
2025-10-20 16:50 ` [RFC 2/3] PM: Don't pass up device_resume() -EBUSY errors Mario Limonciello (AMD)
2025-10-20 16:58 ` Muhammad Usama Anjum
2025-10-20 17:18 ` Rafael J. Wysocki
2025-10-20 17:24 ` Mario Limonciello (AMD) (kernel.org)
2025-10-20 16:50 ` [RFC 3/3] drm/amd: Return -EBUSY for amdgpu_pmops_thaw() on success Mario Limonciello (AMD)
2025-10-20 16:59 ` Muhammad Usama Anjum
2025-10-20 17:21 ` Rafael J. Wysocki
2025-10-20 17:28 ` Mario Limonciello (AMD) (kernel.org)
2025-10-20 17:39 ` Rafael J. Wysocki
2025-10-20 18:32 ` Mario Limonciello (AMD) (kernel.org) [this message]
2025-10-20 18:50 ` Rafael J. Wysocki
2025-10-20 19:14 ` Mario Limonciello (AMD) (kernel.org)
2025-10-20 19:18 ` Rafael J. Wysocki
2025-10-20 19:34 ` Mario Limonciello (AMD) (kernel.org)
2025-10-20 19:55 ` Rafael J. Wysocki
2025-10-20 21:09 ` Mario Limonciello (AMD) (kernel.org)
2025-10-21 13:25 ` Rafael J. Wysocki
2025-10-21 14:19 ` Mario Limonciello (AMD) (kernel.org)
2025-10-21 14:12 ` Muhammad Usama Anjum
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=aec8fc6c-3f9f-4ec1-a929-7a0be6026a3d@kernel.org \
--to=superm1@kernel.org \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=simona@ffwll.ch \
--cc=usama.anjum@collabora.com \
/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