* [PATCH] drm/amdgpu: Avoid extra evict-restore process.
@ 2025-07-09 20:31 Gang Ba
2025-07-09 20:31 ` [PATCH v2] " Gang Ba
0 siblings, 1 reply; 4+ messages in thread
From: Gang Ba @ 2025-07-09 20:31 UTC (permalink / raw)
To: amd-gfx; +Cc: Philip.Yang
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..8ee1b7e62dee 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->task_info->tgid &&
+ 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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2] drm/amdgpu: Avoid extra evict-restore process.
2025-07-09 20:31 [PATCH] drm/amdgpu: Avoid extra evict-restore process Gang Ba
@ 2025-07-09 20:31 ` Gang Ba
0 siblings, 0 replies; 4+ messages in thread
From: Gang Ba @ 2025-07-09 20:31 UTC (permalink / raw)
To: amd-gfx; +Cc: Philip.Yang
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/amdgpu: Avoid extra evict-restore process.
@ 2025-07-08 20:14 Gang Ba
2025-07-09 18:52 ` Philip Yang
0 siblings, 1 reply; 4+ messages in thread
From: Gang Ba @ 2025-07-08 20:14 UTC (permalink / raw)
To: amd-gfx; +Cc: Philip.Yang
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..8ee1b7e62dee 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->task_info->tgid &&
+ 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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] drm/amdgpu: Avoid extra evict-restore process.
2025-07-08 20:14 [PATCH] " Gang Ba
@ 2025-07-09 18:52 ` Philip Yang
0 siblings, 0 replies; 4+ messages in thread
From: Philip Yang @ 2025-07-09 18:52 UTC (permalink / raw)
To: Gang Ba, amd-gfx; +Cc: Philip.Yang
On 2025-07-08 16:14, Gang Ba wrote:
> 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..8ee1b7e62dee 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->task_info->tgid &&
> + vm->task_info->tgid != current->group_leader->pid)
> + return 0;
> +
Only check this for KFD vm, in case this may cause gfx test regression.
if (vm->is_compute_context && vm->task_info->tgid !=
current->group_leader->pid)
return 0;
Regards,
Philip
> timeout = dma_resv_wait_timeout(vm->root.bo->tbo.base.resv,
> DMA_RESV_USAGE_BOOKKEEP,
> true, timeout);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-09 20:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 20:31 [PATCH] drm/amdgpu: Avoid extra evict-restore process Gang Ba
2025-07-09 20:31 ` [PATCH v2] " Gang Ba
-- strict thread matches above, loose matches on Subject: below --
2025-07-08 20:14 [PATCH] " Gang Ba
2025-07-09 18:52 ` Philip Yang
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.