amdgpu_userq_input_trap_params_validate() ends up in amdgpu_userq_input_va_validate(), which walks the VM mapping tree and updates bo_va->userq_va_mapped, so it requires the caller to hold the vm->root.bo reservation. The CWSR branch of mes_userq_mqd_create() called it without that reservation, tripping the dma_resv_assert_held() on every compute queue creation when trap handling is enabled:
WARNING: drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c:232 at amdgpu_userq_input_va_validate+0xb9/0xd0 [amdgpu] Call Trace: mes_userq_mqd_create+0x49c/0x9e0 [amdgpu] amdgpu_userq_ioctl+0x935/0x1070 [amdgpu] drm_ioctl_kernel+0xb3/0x110 [drm] Bracket the call with amdgpu_bo_reserve()/amdgpu_bo_unreserve() like the other input VA validations in the same function. Signed-off-by: James Zhu <[email protected]> --- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c index 2150973b947d..16aa22b25098 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c @@ -508,7 +508,14 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, trap_params.ctx_save_area_address = compute_mqd->ctx_save_area_va; trap_params.cwsr_sz = compute_mqd->ctx_save_area_size; + + r = amdgpu_bo_reserve(queue->vm->root.bo, false); + if (r) { + kfree(compute_mqd); + goto free_mqd; + } r = amdgpu_userq_input_trap_params_validate(queue, &trap_params); + amdgpu_bo_unreserve(queue->vm->root.bo); if (r) { kfree(compute_mqd); goto free_mqd; -- 2.34.1
