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

Liang, Prike Prike.Liang at amd.com
Wed Jun 25 02:02:46 UTC 2025


[Public]

> From: Alex Deucher <alexdeucher at gmail.com>
> Sent: Wednesday, June 25, 2025 1:06 AM
> To: Liang, Prike <Prike.Liang at amd.com>
> Cc: amd-gfx at lists.freedesktop.org; Deucher, Alexander
> <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>
> Subject: Re: [PATCH v4 10/11] drm/amdgpu: only bound the eviction fence to userq
> bo
>
> On Tue, Jun 24, 2025 at 4:46 AM Prike Liang <Prike.Liang at amd.com> wrote:
> >
> > It doesn't need to attach the invalid eviction fence to non-userq's
> > BOs.
> >
> > 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)
>
> Did you mean vm->is_userq_context here?
Yes, it's a typo and will correct it in the later patch.
>
> Alex
>
> >                 amdgpu_eviction_fence_detach(&fpriv->evf_mgr, bo);
> >
> >         bo_va = amdgpu_vm_bo_find(vm, bo);
> > --
> > 2.34.1
> >


More information about the amd-gfx mailing list