On Fri, May 30, 2025 at 3:55 AM Prike Liang <[email protected]> wrote: > > Before destroy the userq buffer object requires validating > the userq unmap status. > > Signed-off-by: Prike Liang <[email protected]> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > index f67969312c39..8eea0e1e1b6a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > @@ -319,6 +319,12 @@ amdgpu_userq_destroy(struct drm_file *filp, int queue_id) > } > amdgpu_bo_unref(&queue->db_obj.obj); > r = amdgpu_userq_unmap_helper(uq_mgr, queue); > + if (r != AMDGPU_USERQ_STATE_UNMAPPED) { > + drm_dbg_driver(adev_to_drm(uq_mgr->adev), "Can't unmap the > queue for destroying.\n"); > + mutex_unlock(&uq_mgr->userq_mutex); > + /*TODO: before return may need to a reset*/ > + return r;
If we return early here, we'll leak memory. Presumably if the unmap failed, the queue is hung, so it shouldn't cause any problems. Alex > + } > amdgpu_userq_cleanup(uq_mgr, queue, queue_id); > mutex_unlock(&uq_mgr->userq_mutex); > > -- > 2.34.1 >
