Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu/userq: dont lock root bo with userq_mutex held

Do not hold reservation lock for root bo if userq_mutex
is already held in the call flow this cause a lock
issue with ttm_bo_delayed_delete.

Its better to lock the vm->root.bo first and then go ahead
with userq_mutex so userq_mutex threads dont get stuck until
the reservation lock is held.

In this case it helps in the function amdgpu_userq_buffer_vas_mapped
for each queue during restore_all.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Sunil Khatri and committed by
Alex Deucher
51358444 1eb90c74

+8 -3
+8 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
··· 270 270 struct amdgpu_bo_va_mapping *mapping; 271 271 bool r; 272 272 273 - if (amdgpu_bo_reserve(vm->root.bo, false)) 274 - return false; 273 + dma_resv_assert_held(vm->root.bo->tbo.base.resv); 275 274 276 275 mapping = amdgpu_vm_bo_lookup_mapping(vm, addr); 277 276 if (!IS_ERR_OR_NULL(mapping) && atomic_read(&mapping->bo_va->userq_va_mapped)) 278 277 r = true; 279 278 else 280 279 r = false; 281 - amdgpu_bo_unreserve(vm->root.bo); 282 280 283 281 return r; 284 282 } ··· 989 991 static int 990 992 amdgpu_userq_restore_all(struct amdgpu_userq_mgr *uq_mgr) 991 993 { 994 + struct amdgpu_fpriv *fpriv = uq_mgr_to_fpriv(uq_mgr); 995 + struct amdgpu_vm *vm = &fpriv->vm; 992 996 struct amdgpu_usermode_queue *queue; 993 997 unsigned long queue_id; 994 998 int ret = 0, r; 999 + 1000 + 1001 + if (amdgpu_bo_reserve(vm->root.bo, false)) 1002 + return false; 995 1003 996 1004 mutex_lock(&uq_mgr->userq_mutex); 997 1005 /* Resume all the queues for this process */ ··· 1016 1012 1017 1013 } 1018 1014 mutex_unlock(&uq_mgr->userq_mutex); 1015 + amdgpu_bo_unreserve(vm->root.bo); 1019 1016 1020 1017 if (ret) 1021 1018 drm_file_err(uq_mgr->file,