Skip to content

Commit d7d7b94

Browse files
Lang Yualexdeucher
authored andcommitted
drm/amdkfd: Fix an eviction fence leak
Only creating a new reference for each process instead of each VM. Fixes: 9a1c133 ("drm/amdkfd: Run restore_workers on freezable WQs") Suggested-by: Felix Kuehling <[email protected]> Signed-off-by: Lang Yu <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 5fa4362) Cc: [email protected]
1 parent 5b272bf commit d7d7b94

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,8 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info,
14391439
list_add_tail(&vm->vm_list_node,
14401440
&(vm->process_info->vm_list_head));
14411441
vm->process_info->n_vms++;
1442-
1443-
*ef = dma_fence_get(&vm->process_info->eviction_fence->base);
1442+
if (ef)
1443+
*ef = dma_fence_get(&vm->process_info->eviction_fence->base);
14441444
mutex_unlock(&vm->process_info->lock);
14451445

14461446
return 0;

drivers/gpu/drm/amd/amdkfd/kfd_process.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,12 +1702,15 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd,
17021702

17031703
ret = amdgpu_amdkfd_gpuvm_acquire_process_vm(dev->adev, avm,
17041704
&p->kgd_process_info,
1705-
&ef);
1705+
p->ef ? NULL : &ef);
17061706
if (ret) {
17071707
dev_err(dev->adev->dev, "Failed to create process VM object\n");
17081708
return ret;
17091709
}
1710-
RCU_INIT_POINTER(p->ef, ef);
1710+
1711+
if (!p->ef)
1712+
RCU_INIT_POINTER(p->ef, ef);
1713+
17111714
pdd->drm_priv = drm_file->private_data;
17121715

17131716
ret = kfd_process_device_reserve_ib_mem(pdd);

0 commit comments

Comments
 (0)