AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arisa Snowbell" <arisa.snowbell@gmail.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/amdgpu/userq: keep the restore worker out of system sleep
Date: Tue, 24 Nov 2026 16:23:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-231548@kernel.org> (raw)
In-Reply-To: <20261124141416.11034-1-arisa.snowbell@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/amdgpu/userq: system_freezable_wq is not frozen during
  hibernation dpm_prepare()
--

commit f10cd6c65f3801c912d63876fd1a81a692e96c5a
Author: Arisa Snowbell <arisa.snowbell@gmail.com>

drm/amdgpu/userq: keep the restore worker out of system sleep

This commit moves the user queue restore worker (resume_work) to
system_freezable_wq and skips mapping evicted queues in
amdgpu_userq_resume(), queuing the restore worker for them instead.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> index 2924f34da316a..358a6c8ce45f5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> @@ -91,7 +91,7 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
>  	dma_fence_put(ev_fence);
>  
>  	if (!evf_mgr->shutdown)
> -		schedule_delayed_work(&uq_mgr->resume_work, 0);
> +		queue_delayed_work(system_freezable_wq, &uq_mgr->resume_work, 0);
>  
>  	mutex_unlock(&uq_mgr->userq_mutex);
>  }

[Severity: High]
Can uq_mgr->resume_work still run during amdgpu_device_prepare() on the
hibernation (S4) path?

In hibernate(), freeze_processes() passes user_only = true to
try_to_freeze_tasks(), which skips freeze_workqueues_begin().
hibernation_snapshot() then calls dpm_prepare(PMSG_FREEZE) before
freeze_kernel_threads() freezes freezable workqueues:

kernel/power/hibernate.c:hibernation_snapshot() {
	...
	error = dpm_prepare(PMSG_FREEZE);
	if (error)
		goto Complete;

	/* Preallocate image memory before freezing kernel threads and shutting down devices. */
	error = hibernate_preallocate_memory();
	if (error)
		goto Complete;

	error = freeze_kernel_threads();
	...
}

When amdgpu_pmops_prepare() -> amdgpu_device_prepare() ->
amdgpu_device_evict_resources() evicts a user queue BO during hibernation
prepare, system_freezable_wq is not frozen yet, so uq_mgr->resume_work
runs immediately and can still deadlock with ttm_bo_evict_first() on the
BO reservations or move evicted BOs back into VRAM before
freeze_kernel_threads() runs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124141416.11034-1-arisa.snowbell@gmail.com?part=1

  parent reply	other threads:[~2026-11-24 16:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  2:32 [PATCH 0/1] drm/amdgpu/userq: fix S3 suspend hang with user queues Arisa Snowbell
2026-11-24  2:32 ` [PATCH 1/1] drm/amdgpu/userq: don't restore user queues during system sleep Arisa Snowbell
2026-11-24  8:56   ` sashiko-bot
2026-11-24 10:43     ` Arisa Snowbell
2026-11-24 12:15 ` [PATCH 0/1] drm/amdgpu/userq: fix S3 suspend hang with user queues Christian König
2026-11-24 13:01   ` Arisa Snowbell
2026-11-24 13:02 ` [PATCH v2] drm/amdgpu/userq: queue the restore worker on a freezable workqueue Arisa Snowbell
2026-11-24 13:51   ` Arisa Snowbell
2026-11-24 14:14   ` [PATCH v3] drm/amdgpu/userq: keep the restore worker out of system sleep Arisa Snowbell
2026-11-24 14:16     ` Arisa Snowbell
2026-11-24 16:23     ` sashiko-bot [this message]
2026-11-24 16:14   ` [PATCH v2] drm/amdgpu/userq: queue the restore worker on a freezable workqueue sashiko-bot

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-231548@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arisa.snowbell@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox