On 24.06.25 10:45, Prike Liang wrote: > The user queue object destroy requires ensuring its > VA has been unmapped prior to the queue being destroyed. > Otherwise, the kernel driver should report an invalidated > error to the user IOCLT request.
Well that is completely nonsense. It must be just the other way around, you need to destroy the queue first and *then* unmap the VAs! Regards, Christian. > > Signed-off-by: Prike Liang <[email protected]> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > index cbbd1860a69a..79b263c18eb1 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > @@ -477,12 +477,24 @@ amdgpu_userq_destroy(struct drm_file *filp, int > queue_id) > amdgpu_bo_unpin(queue->db_obj.obj); > amdgpu_bo_unreserve(queue->db_obj.obj); > } > + > + /* > + * At this point the userq obj va should be unmapped, > + * otherwise will return error to user. > + */ > + if (amdgpu_userq_buffer_vas_mapped(&fpriv->vm, queue)) { > + drm_warn(adev_to_drm(uq_mgr->adev), "the userq obj va shouldn't > be mapped during destroying userq\n"); > + r= -EINVAL; > + } > + > r = amdgpu_userq_unmap_helper(uq_mgr, queue); > /*TODO: It requires a reset for unmap error*/ > if (r != AMDGPU_USERQ_STATE_UNMAPPED) { > drm_warn(adev_to_drm(uq_mgr->adev), "trying to destroy a HW > mapping userq\n"); > r = -ETIMEDOUT; > } > + > + amdgpu_userq_buffer_vas_put(&fpriv->vm, queue); > amdgpu_userq_cleanup(uq_mgr, queue, queue_id); > mutex_unlock(&uq_mgr->userq_mutex); > > @@ -603,6 +615,9 @@ amdgpu_userq_create(struct drm_file *filp, union > drm_amdgpu_userq *args) > goto unlock; > } > > + /* refer to the userq objects vm bo*/ > + amdgpu_userq_buffer_vas_get(queue->vm, queue); > + > qid = idr_alloc(&uq_mgr->userq_idr, queue, 1, AMDGPU_MAX_USERQ_COUNT, > GFP_KERNEL); > if (qid < 0) { > drm_file_err(uq_mgr->file, "Failed to allocate a queue id\n");
