On 11-05-2026 06:57 pm, Christian König wrote:
On 5/8/26 12:39, Sunil Khatri wrote:
mqd and fw objects are queue core objects which should remain
valid and never be unmapped and evicted for user queues to work
properly.

During eviction if these buffers are evicted the hw continue to
use the invalid addresses and caused page faults and system hung.

Signed-off-by: Sunil Khatri <[email protected]>
We should probably use the eviction fence instead of pinning, but that can come 
in a later patch set.

yes, that is todo but also on other hand these buffers need to stay valid till the queue stays valid and active so keeping these buffers alive is fine but yes associating with eviction fence sounds correct.

Regards
Sunil khatri


Reviewed-by: Christian König <[email protected]> for now.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 06b7b4228065..813df2d87dc3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -504,16 +504,20 @@ int amdgpu_userq_create_object(struct amdgpu_userq_mgr 
*uq_mgr,
                goto free_obj;
        }
+ r = amdgpu_bo_pin(userq_obj->obj, AMDGPU_GEM_DOMAIN_GTT);
+       if (r)
+               goto unresv;
+
        r = amdgpu_ttm_alloc_gart(&(userq_obj->obj)->tbo);
        if (r) {
                drm_file_err(uq_mgr->file, "Failed to alloc GART for userqueue 
object (%d)", r);
-               goto unresv;
+               goto unpin_bo;
        }
r = amdgpu_bo_kmap(userq_obj->obj, &userq_obj->cpu_ptr);
        if (r) {
                drm_file_err(uq_mgr->file, "Failed to map BO for userqueue 
(%d)", r);
-               goto unresv;
+               goto unpin_bo;
        }
userq_obj->gpu_addr = amdgpu_bo_gpu_offset(userq_obj->obj);
@@ -521,11 +525,13 @@ int amdgpu_userq_create_object(struct amdgpu_userq_mgr 
*uq_mgr,
        memset(userq_obj->cpu_ptr, 0, size);
        return 0;
+unpin_bo:
+       amdgpu_bo_unpin(userq_obj->obj);
  unresv:
        amdgpu_bo_unreserve(userq_obj->obj);
-
  free_obj:
        amdgpu_bo_unref(&userq_obj->obj);
+
        return r;
  }
@@ -533,6 +539,7 @@ void amdgpu_userq_destroy_object(struct amdgpu_userq_mgr *uq_mgr,
                                 struct amdgpu_userq_obj *userq_obj)
  {
        amdgpu_bo_kunmap(userq_obj->obj);
+       amdgpu_bo_unpin(userq_obj->obj);
        amdgpu_bo_unref(&userq_obj->obj);
  }

Reply via email to