[PATCH v4 10/11] drm/amdgpu: only bound the eviction fence to userq bo

Liang, Prike Prike.Liang at amd.com
Tue Jul 1 13:21:24 UTC 2025


[Public]

Regards,
      Prike

> -----Original Message-----
> From: Koenig, Christian <Christian.Koenig at amd.com>
> Sent: Wednesday, June 25, 2025 3:50 PM
> To: Liang, Prike <Prike.Liang at amd.com>; amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: Re: [PATCH v4 10/11] drm/amdgpu: only bound the eviction fence to userq
> bo
>
> On 24.06.25 10:45, Prike Liang wrote:
> > It doesn't need to attach the invalid eviction fence to non-userq's
> > BOs.
>
> Clear NAK to this.
>
> BOs are often created before the userqs are created.
Yes, but the eviction fence will only be available when the userq task is scheduled. Before requesting the userq-create IOCTL,
the eviction fence is invalid and hasn't been created. In this case, do we need to attach an invalid eviction fence to the
BO?

> Regards,
> Christian.
>
> >
> > Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 16 +++++++++-------
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > index 2c68118fe9fd..50356aa23a99 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > @@ -294,12 +294,14 @@ static int amdgpu_gem_object_open(struct
> drm_gem_object *obj,
> >     else
> >             ++bo_va->ref_count;
> >
> > -   /* attach gfx eviction fence */
> > -   r = amdgpu_eviction_fence_attach(&fpriv->evf_mgr, abo);
> > -   if (r) {
> > -           DRM_DEBUG_DRIVER("Failed to attach eviction fence to BO\n");
> > -           amdgpu_bo_unreserve(abo);
> > -           return r;
> > +   /* attach gfx eviction fence when userq created*/
> > +   if (vm->is_userq_context) {
> > +           r = amdgpu_eviction_fence_attach(&fpriv->evf_mgr, abo);
> > +           if (r) {
> > +                   DRM_DEBUG_DRIVER("Failed to attach eviction fence to
> BO\n");
> > +                   amdgpu_bo_unreserve(abo);
> > +                   return r;
> > +           }
> >     }
> >
> >     amdgpu_bo_unreserve(abo);
> > @@ -365,7 +367,7 @@ static void amdgpu_gem_object_close(struct
> drm_gem_object *obj,
> >                     goto out_unlock;
> >     }
> >
> > -   if (!amdgpu_vm_is_bo_always_valid(vm, bo))
> > +   if (!amdgpu_vm_is_bo_always_valid(vm, bo) && vm->is_compute_context)
> >             amdgpu_eviction_fence_detach(&fpriv->evf_mgr, bo);
> >
> >     bo_va = amdgpu_vm_bo_find(vm, bo);



More information about the amd-gfx mailing list