Re: [PATCH 40/55] drm/i915: Refactor blocking waits

Chris Wilson
2016-07-27T10:48:50Z

On Wed, Jul 27, 2016 at 01:40:06PM +0300, Joonas Lahtinen wrote:
> On ke, 2016-07-27 at 08:04 +0100, Chris Wilson wrote:
> > On Wed, Jul 27, 2016 at 09:04:03AM +0300, Joonas Lahtinen wrote:
> > >
> > > On ma, 2016-07-25 at 18:32 +0100, Chris Wilson wrote:
> > > >
> > > > Tidy up the for loops that handle waiting for read/write vs read-only
> > > > access.
> > > >
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > ---
> > > >  drivers/gpu/drm/i915/i915_gem.c | 158 +++++++++++++++++++---------------------
> > > >  1 file changed, 75 insertions(+), 83 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > > > index 3f6b69dcaccb..2d86a0c3f295 100644
> > > > --- a/drivers/gpu/drm/i915/i915_gem.c
> > > > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > > > @@ -1339,6 +1339,23 @@ put_rpm:
> > > >   return ret;
> > > >  }
> > > >
> > > > +static void
> > > > +i915_gem_object_retire_request(struct drm_i915_gem_object *obj,
> > > > +        struct drm_i915_gem_request *req)
> > > > +{
> > > > + int idx = req->engine->id;
> > > > +
> > > > + if (i915_gem_active_peek(&obj->last_read[idx],
> > > > +  &obj->base.dev->struct_mutex) == req)
> > > > + i915_gem_object_retire__read(obj, idx);
> > > > + else if (i915_gem_active_peek(&obj->last_write,
> > > > +       &obj->base.dev->struct_mutex) == req)
> > > > + i915_gem_object_retire__write(obj);
> > > If these functions will use same mutex (be it different than
> > > struct_mutex) in all invocations, I'd make an alias for it.
> > Why? It is written like this to prevent the compiler doing anything when
> > not debugging.
>
> What debuggin related is there, could you elborate? (PS. A branch would
> help having the big picture clearer).

The mutex is only used for debug annotations.
See https://cgit.freedesktop.org/~ickle/linux-2.6/log/?h=tasklet
-Chris

--
Chris Wilson, Intel Open Source Technology Centre