AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Lingshan <lingshan.zhu@amd.com>
To: <felix.kuehling@amd.com>, <alexander.deucher@amd.com>
Cc: <ray.huang@amd.com>, <amd-gfx@lists.freedesktop.org>,
	Zhu Lingshan <lingshan.zhu@amd.com>
Subject: [PATCH V5 11/18] amdkfd: process pointer of a HIQ should be NULL
Date: Fri, 17 Oct 2025 16:42:15 +0800	[thread overview]
Message-ID: <20251017084222.54721-12-lingshan.zhu@amd.com> (raw)
In-Reply-To: <20251017084222.54721-1-lingshan.zhu@amd.com>

In kq_initialize, queue->process of a HIQ should
be NULL as initialized, 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 <lingshan.zhu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c |  1 -
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h         |  1 -
 drivers/gpu/drm/amd/amdkfd/kfd_process.c      | 18 ------------------
 3 files changed, 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 7ce4531ec3bc..19ea759568a6 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
@@ -129,7 +129,6 @@ 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);
 
 	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 71c0cefb87ea..42b6492d7682 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -1060,7 +1060,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 157145c94314..35a9e91650ca 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -985,24 +985,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;
-- 
2.51.0


  parent reply	other threads:[~2025-10-17  8:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  8:42 [PATCH V5 00/18] [PATCH V4 00/18] amdkfd: Implement kfd multiple contexts Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 01/18] amdkfd: enlarge the hashtable of kfd_process Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 02/18] amdkfd: mark the first kfd_process as the primary one Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 03/18] amdkfd: find_process_by_mm always return the primary context Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 04/18] amdkfd: Introduce kfd_create_process_sysfs as a separate function Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 05/18] amdkfd: destroy kfd secondary contexts through fd close Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 06/18] amdkfd: process svm ioctl only on the primary kfd process Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 07/18] amdkfd: process USERPTR allocation " Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 08/18] amdkfd: identify a secondary kfd process by its id Zhu Lingshan
2025-10-17 23:16   ` Felix Kuehling
2025-10-22  6:56     ` Zhu, Lingshan
2025-10-17  8:42 ` [PATCH V5 09/18] amdkfd: find kfd_process by filep->private_data in kfd_mmap Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 10/18] amdkfd: remove DIQ support Zhu Lingshan
2025-10-17  8:42 ` Zhu Lingshan [this message]
2025-10-17  8:42 ` [PATCH V5 12/18] amdkfd: remove test_kq Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 13/18] amdkfd: introduce new helper kfd_lookup_process_by_id Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 14/18] amdkfd: record kfd context id into kfd process_info Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 15/18] amdkfd: record kfd context id in amdkfd_fence Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 16/18] amdkfd: fence handler evict and restore a kfd process by its context id Zhu Lingshan
2025-10-17  8:42 ` [PATCH V5 17/18] amdkfd: process debug trap ioctl only on a primary context Zhu Lingshan
2025-10-17 23:32   ` Felix Kuehling
2025-10-22  6:55     ` Zhu, Lingshan
2025-10-17  8:42 ` [PATCH V5 18/18] amdkfd: introduce new ioctl AMDKFD_IOC_CREATE_PROCESS Zhu Lingshan
2025-10-17 23:55   ` Felix Kuehling
2025-10-22  6:59     ` Zhu, Lingshan
2025-10-17 23:58 ` [PATCH V5 00/18] [PATCH V4 00/18] amdkfd: Implement kfd multiple contexts Felix Kuehling
2025-10-22  7:01   ` Zhu, Lingshan

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=20251017084222.54721-12-lingshan.zhu@amd.com \
    --to=lingshan.zhu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=ray.huang@amd.com \
    /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