[PATCH 2/3] drm/xe/bo: Allow eviction of unbound local bos
Matthew Brost
matthew.brost at intel.com
Tue Feb 27 17:36:51 UTC 2024
On Tue, Feb 27, 2024 at 12:54:43PM +0100, Thomas Hellström wrote:
> On Mon, 2024-02-26 at 21:42 +0000, Matthew Brost wrote:
> > On Mon, Feb 26, 2024 at 05:44:54PM +0100, Thomas Hellström wrote:
> > > Local bos that don't have any gpu_vmas set up are allowed
> > > to be evicted. Support that.
> > >
> > > Fixes: 24f947d58fe5 ("drm/xe: Use DRM GPUVM helpers for external-
> > > and evicted objects")
> > > Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> > > Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > > Cc: Matthew Brost <matthew.brost at intel.com>
> > > Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> > > Cc: Oded Gabbay <ogabbay at kernel.org>
> > > Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> > > ---
> > > drivers/gpu/drm/xe/xe_bo.c | 7 ++++++-
> > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_bo.c
> > > b/drivers/gpu/drm/xe/xe_bo.c
> > > index 143d93632253..2931b9030503 100644
> > > --- a/drivers/gpu/drm/xe/xe_bo.c
> > > +++ b/drivers/gpu/drm/xe/xe_bo.c
> > > @@ -1057,10 +1057,15 @@ static bool xe_bo_eviction_valuable(struct
> > > ttm_buffer_object *ttm_bo,
> > > struct xe_vm *vm = xe_bo->vm;
> > >
> > > if (vm && !drm_gpuvm_is_extobj(&vm->gpuvm,
> > > &ttm_bo->base) &&
> > > - vm->is_validating)
> > > + vm->is_validating) {
> > > + /* Not bound to the vm? */
> > > + if (list_empty(&ttm_bo->base.gpuva.list))
> >
> > Do we not need a lock here? Maybe add drm_gem_gpuva_assert_lock_held
> > to
> > make that clear?
>
> Good point. I'll add an assert here. The lock is needed to
> read vm->is_validating as well.
>
With that fixed:
Reviewed-by: Matthew Brost <matthew.brot at intel.com>
> /Thomas
>
>
> >
> > Matt
> >
> > > + goto allow;
> > > return false;
> > > + }
> > > }
> > >
> > > +allow:
> > > return ttm_bo_eviction_valuable(ttm_bo, place);
> > > }
> > >
> > > --
> > > 2.43.0
> > >
>
More information about the Intel-xe
mailing list