[Intel-gfx] [PATCH 03/14] drm/i915: Flush idle barriers when waiting

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 25 19:16:06 UTC 2020


Quoting Tvrtko Ursulin (2020-02-25 19:07:43)
> 
> On 24/02/2020 09:59, Chris Wilson wrote:
> > -int i915_active_wait(struct i915_active *ref)
> > +static int flush_barrier(struct active_node *it)
> >   {
> > -     struct active_node *it, *n;
> > -     int err = 0;
> > +     struct intel_engine_cs *engine;
> >   
> > -     might_sleep();
> > +     if (!is_barrier(&it->base))
> > +             return 0;
> >   
> > -     if (!i915_active_acquire_if_busy(ref))
> > +     engine = __barrier_to_engine(it);
> > +     smp_rmb(); /* serialise with add_active_barriers */
> > +     if (!is_barrier(&it->base))
> >               return 0;
> 
> What is the purpose of the first !is_barrier check? Just to kind of look 
> better by not calling __bariier_to_engine on the wrong thing?

Yeah, and that smp_rmb() is on the expensive side (enough to justify a
branch). If I was confident I would mark up that first !is_barrier() with
likely(). Hmm, does the kernel still have the infrastructure to warn
those annotations are wrong?
-Chris


More information about the Intel-gfx mailing list