Hi, Turns out I found the answer to my own question while testing, sorry for the extra mail. v2 on its own isn't enough: with Hyprland on user queues, the first S3 resume failed when amdgpu_userq_resume() mapped the queues again:
MES(0) failed to respond to msg=ADD_QUEUE fence_wait_ret=0 status=0x0_0 [drm:mes_userq_map [amdgpu]] *ERROR* Failed to map queue in HW, err (-110) amdgpu 0000:03:00.0: PM: dpm_run_callback(): pci_pm_resume returns -110 With the restore worker frozen, the BOs are still evicted at that point. Queuing the restore worker for evicted processes, instead of mapping their queues in resume, fixes it for me: the desktop and a game, both on user queues, came back fine after resume. I'll send that as v3 after a few more suspends. Thanks, Arisa On Tue, Nov 24, 2026 at 2:04 PM Arisa Snowbell <[email protected]> wrote: > > Before system sleep, amdgpu_device_prepare() moves all BOs out of VRAM. > When it evicts a BO of a process with user queues, the eviction fence of > that process signals, and amdgpu_eviction_fence_suspend_worker() queues > the restore worker on system_wq. That workqueue is not frozen, so the > restore worker runs while the eviction is still going on and moves the > BOs back into VRAM, waiting for the page table updates while it holds > their reservations. > > On an RX 9070 XT (gfx12) this hung S3 suspend for good after a few hours > of uptime. A restore worker waited forever on a page table update fence > while holding the reservations, and systemd-sleep waited in > ttm_bo_evict_first() for one of them. > > Queue the restore worker on system_freezable_wq, like the amdkfd restore > workers. Its work is frozen before dpm_prepare(), so a restore queued > during the eviction stays pending until amdgpu_userq_suspend() cancels > it. > > Fixes: 44cfdf368fb7 ("drm/amdgpu: resume gfx userqueues") > Signed-off-by: Arisa Snowbell <[email protected]> > --- > v2: drop the restore block flag and the resume changes, only move the > restore worker to system_freezable_wq (Christian). v1 claimed that > for hibernation dpm_prepare() runs before freeze_kernel_threads(), > which is wrong. > > drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c > index f8652fd0525d..18b11d7f457e 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); > } > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > index 9fc8e9e97595..f52c2096c5b4 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > @@ -456,7 +456,7 @@ amdgpu_userq_ensure_ev_fence(struct amdgpu_userq_mgr > *uq_mgr, > * Looks like there was no pending resume work, > * add one now to create a valid eviction fence > */ > - schedule_delayed_work(&uq_mgr->resume_work, 0); > + queue_delayed_work(system_freezable_wq, &uq_mgr->resume_work, > 0); > goto retry; > } > dma_fence_put(ev_fence); > -- > 2.56.1 >
