<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <pre>On 8/8/2025 4:55 AM, Felix Kuehling wrote:</pre>
    <blockquote type="cite" cite="mid:c8b04e72-9085-47ab-bdb1-6f0f3bbc4752@amd.com">
      <pre wrap="" class="moz-quote-pre">
On 2025-08-04 7:05, Zhu Lingshan wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre">In kq_initialize, queue->process of a HIQ should
be set to NULL because it does not belong to any kfd_process.

This commit decommisions the function kfd_get_process() because
it can not locate a specific kfd_process among multiple
contexts and not any code path calls it after this commit.

Signed-off-by: Zhu Lingshan <a class="moz-txt-link-rfc2396E" href="mailto:lingshan.zhu@amd.com"><lingshan.zhu@amd.com></a>
---
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c |  3 ++-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h         |  1 -
 drivers/gpu/drm/amd/amdkfd/kfd_process.c      | 18 ------------------
 3 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
index 2b0a830f5b29..ebee37937783 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
@@ -144,7 +144,8 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
                goto err_init_queue;
 
        kq->queue->device = dev;
-       kq->queue->process = kfd_get_process(current);
+       if (type == KFD_QUEUE_TYPE_HIQ)
+               kq->queue->process = NULL;
</pre>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
I think this should either unconditionally set the process to NULL for kernel queues, or not touch it at all, because it's probably 0-initialized at allocation time.</pre>
    </blockquote>
    <pre>I will leave it untouched.</pre>
    <blockquote type="cite" cite="mid:c8b04e72-9085-47ab-bdb1-6f0f3bbc4752@amd.com">
      <pre wrap="" class="moz-quote-pre">

Either way, this commit should come after the one that removes the DIQ type, because DIQ did belong to a process.</pre>
    </blockquote>
    <pre>Yes

Thanks
Lingshan</pre>
    <blockquote type="cite" cite="mid:c8b04e72-9085-47ab-bdb1-6f0f3bbc4752@amd.com">
      <pre wrap="" class="moz-quote-pre">

Regards,
  Felix


</pre>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre"> 
        kq->queue->mqd_mem_obj = kq->mqd_mgr->allocate_mqd(kq->mqd_mgr->dev,
                                        &kq->queue->properties);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index d140463e221b..25534473c28f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -1050,7 +1050,6 @@ void kfd_process_destroy_wq(void);
 void kfd_cleanup_processes(void);
 struct kfd_process *kfd_create_process(struct task_struct *thread);
 int kfd_create_process_sysfs(struct kfd_process *process);
-struct kfd_process *kfd_get_process(const struct task_struct *task);
 struct kfd_process *kfd_lookup_process_by_pasid(u32 pasid,
                                                 struct kfd_process_device **pdd);
 struct kfd_process *kfd_lookup_process_by_mm(const struct mm_struct *mm);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 8e498fd35b8c..0c3f0cc16bf4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -989,24 +989,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread)
        return process;
 }
 
-struct kfd_process *kfd_get_process(const struct task_struct *thread)
-{
-       struct kfd_process *process;
-
-       if (!thread->mm)
-               return ERR_PTR(-EINVAL);
-
-       /* Only the pthreads threading model is supported. */
-       if (thread->group_leader->mm != thread->mm)
-               return ERR_PTR(-EINVAL);
-
-       process = find_process(thread, false);
-       if (!process)
-               return ERR_PTR(-EINVAL);
-
-       return process;
-}
-
 static struct kfd_process *find_process_by_mm(const struct mm_struct *mm)
 {
        struct kfd_process *process;
</pre>
      </blockquote>
    </blockquote>
  </body>
</html>