All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gang Ba <Gang.Ba@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Philip.Yang@amd.com>
Subject: [PATCH v2] drm/amdgpu: Avoid extra evict-restore process.
Date: Wed, 9 Jul 2025 16:31:57 -0400	[thread overview]
Message-ID: <20250709203157.404490-2-Gang.Ba@amd.com> (raw)
In-Reply-To: <20250709203157.404490-1-Gang.Ba@amd.com>

If vm belongs to another process, this is fclose after fork,
wait may enable signaling KFD eviction fence and cause parent process queue evicted.

Signed-off-by: Gang Ba <Gang.Ba@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f042372d9f2e..01e4f3ec22e9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2410,6 +2410,13 @@ void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,
  */
 long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout)
 {
+	/* If vm belongs to another process, this is fclose after fork,
+	 * wait may enable signaling KFD eviction fence and cause parent process queue evicted.
+	 */
+	if (vm->is_compute_context &&
+	    vm->task_info->tgid != current->group_leader->pid)
+	      return 0;
+
 	timeout = dma_resv_wait_timeout(vm->root.bo->tbo.base.resv,
 					DMA_RESV_USAGE_BOOKKEEP,
 					true, timeout);
-- 
2.34.1


      reply	other threads:[~2025-07-09 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 20:31 [PATCH] drm/amdgpu: Avoid extra evict-restore process Gang Ba
2025-07-09 20:31 ` Gang Ba [this message]

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=20250709203157.404490-2-Gang.Ba@amd.com \
    --to=gang.ba@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.