<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Hi Alex,<br>
    <br>
    This patch didn't help to resolve the system hang issue during
    suspend that was introduced<br>
    by the series - <a class="moz-txt-link-freetext" href="https://patchwork.freedesktop.org/series/141717/">https://patchwork.freedesktop.org/series/141717/</a><br>
    <br>
    But as you mentioned, the runtime pm needs this change while user
    queues are running.<br>
    Reviewed-by:
    Arunpravin Paneer Selvam <<a href="mailto:Arunpravin.PaneerSelvam@amd.com" class="moz-txt-link-freetext">Arunpravin.PaneerSelvam@amd.com</a>><br>
    <br>
    Regards,<br>
    Arun.<br>
    <br>
    <div class="moz-cite-prefix">On 3/20/2025 10:22 PM, Alex Deucher
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20250320165249.1238463-2-alexander.deucher@amd.com">
      <pre wrap="" class="moz-quote-pre">Similar to KFD, prevent runtime pm while user queues are active.

Signed-off-by: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 7d49a0bede1e2..4ff2e423c50cb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2705,6 +2705,29 @@ static int amdgpu_runtime_idle_check_display(struct device *dev)
        return 0;
 }
 
+static int amdgpu_runtime_idle_check_userq(struct device *dev)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+       struct amdgpu_device *adev = drm_to_adev(drm_dev);
+       struct amdgpu_usermode_queue *queue;
+       struct amdgpu_userq_mgr *uqm, *tmp;
+       int queue_id;
+       int ret = 0;
+
+       mutex_lock(&adev->userq_mutex);
+       list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) {
+               idr_for_each_entry(&uqm->userq_idr, queue, queue_id) {
+                       ret = -EBUSY;
+                       goto done;
+               }
+       }
+done:
+       mutex_unlock(&adev->userq_mutex);
+
+       return ret;
+}
+
 static int amdgpu_pmops_runtime_suspend(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
@@ -2718,6 +2741,9 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
        }
 
        ret = amdgpu_runtime_idle_check_display(dev);
+       if (ret)
+               return ret;
+       ret = amdgpu_runtime_idle_check_userq(dev);
        if (ret)
                return ret;
 
@@ -2841,7 +2867,11 @@ static int amdgpu_pmops_runtime_idle(struct device *dev)
        }
 
        ret = amdgpu_runtime_idle_check_display(dev);
+       if (ret)
+               goto done;
 
+       ret = amdgpu_runtime_idle_check_userq(dev);
+done:
        pm_runtime_mark_last_busy(dev);
        pm_runtime_autosuspend(dev);
        return ret;
</pre>
    </blockquote>
    <br>
  </body>
</html>