[Intel-gfx] [PATCH 5/5] drm/i915: Avoid calling i915_gem_object_unbind holding object lock

Chris Wilson chris at chris-wilson.co.uk
Sat Dec 7 00:20:40 UTC 2019


Quoting Andi Shyti (2019-12-07 00:03:27)
> Hi Chris,
> 
> [...]
> 
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> > index 808eb327a29b..53e28e417cc9 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> > @@ -187,21 +187,23 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
> >  {
> >       int ret;
> >  
> > -     assert_object_held(obj);
> > -
> >       if (obj->cache_level == cache_level)
> 
> you're checking here...
> 
> >               return 0;
> >  
> > -     ret = i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE);
> > +     ret = i915_gem_object_lock_interruptible(obj);
> >       if (ret)
> >               return ret;
> >  
> > -     /* The cache-level will be applied when each vma is rebound. */
> > +     /* Always invalidate stale cachelines */
> > +     if (obj->cache_level != cache_level) {
> 
> ... and here... you might want to get rid of this one?

One outside, one inside the lock.
-Chris


More information about the Intel-gfx mailing list