<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2022-06-27 15:05, Deucher, Alexander
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:BL1PR12MB5144901899EFC626052EBD0AF7B99@BL1PR12MB5144.namprd12.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">[Public]

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">-----Original Message-----
From: amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> On Behalf Of Philip
Yang
Sent: Monday, June 27, 2022 1:32 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
Cc: Yang, Philip <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a>
Subject: [PATCH 1/1] Revert "drm/amdkfd: Free queue after unmap queue
success"

This reverts commit 150c1266d78fbaa0fc5f89461daafae416db1c3e.

This causes KFDTest regression on gfx9, will submit new patch after fixing.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Which test?  Also, missing your s-o-b.  With that fixed:
Acked-by: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a></pre>
    </blockquote>
    <p>I will update commit with KFDMemoryTest.MemoryRegister test
      failed, add s-o-b then push.</p>
    <p>Thanks,</p>
    <p>Philip<br>
    </p>
    <blockquote type="cite" cite="mid:BL1PR12MB5144901899EFC626052EBD0AF7B99@BL1PR12MB5144.namprd12.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">---
 .../drm/amd/amdkfd/kfd_device_queue_manager.c | 28 ++++++++-----------
 .../amd/amdkfd/kfd_process_queue_manager.c    |  2 +-
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 21e451acfa59..93a0b6995430 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -1881,22 +1881,6 @@ static int destroy_queue_cpsch(struct
device_queue_manager *dqm,

        }

-       if (q->properties.is_active) {
-               if (!dqm->dev->shared_resources.enable_mes) {
-                       retval = execute_queues_cpsch(dqm,
-
KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0);
-                       if (retval == -ETIME)
-                               qpd->reset_wavefronts = true;
-               } else {
-                       retval = remove_queue_mes(dqm, q, qpd);
-               }
-
-               if (retval)
-                       goto failed_unmap_queue;
-
-               decrement_queue_count(dqm, qpd, q);
-       }
-
        mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
                        q->properties.type)];

@@ -1910,6 +1894,17 @@ static int destroy_queue_cpsch(struct
device_queue_manager *dqm,

        list_del(&q->list);
        qpd->queue_count--;
+       if (q->properties.is_active) {
+               if (!dqm->dev->shared_resources.enable_mes) {
+                       decrement_queue_count(dqm, qpd, q);
+                       retval = execute_queues_cpsch(dqm,
+
KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0);
+                       if (retval == -ETIME)
+                               qpd->reset_wavefronts = true;
+               } else {
+                       retval = remove_queue_mes(dqm, q, qpd);
+               }
+       }

        /*
         * Unconditionally decrement this counter, regardless of the queue's
@@ -1926,7 +1921,6 @@ static int destroy_queue_cpsch(struct
device_queue_manager *dqm,

        return retval;

-failed_unmap_queue:
 failed_try_destroy_debugged_queue:

        dqm_unlock(dqm);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index a46e2a37b4a6..c9c205df4a14 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -422,6 +422,7 @@ int pqm_destroy_queue(struct
process_queue_manager *pqm, unsigned int qid)
        }

        if (pqn->q) {
+               kfd_procfs_del_queue(pqn->q);
                dqm = pqn->q->device->dqm;
                retval = dqm->ops.destroy_queue(dqm, &pdd->qpd, pqn->q);
                if (retval) {
@@ -445,7 +446,6 @@ int pqm_destroy_queue(struct
process_queue_manager *pqm, unsigned int qid)
                                amdgpu_amdkfd_free_gtt_mem(dev->adev,
pqn->q->wptr_bo);

                }
-               kfd_procfs_del_queue(pqn->q);
                uninit_queue(pqn->q);
        }

--
2.35.1
</pre>
      </blockquote>
    </blockquote>
  </body>
</html>