[Intel-gfx] [PATCH 1/2] drm/i915: Wrap the protected active RCU dereference in a helper

Chris Wilson chris at chris-wilson.co.uk
Tue Aug 9 07:08:52 UTC 2016


On Tue, Aug 09, 2016 at 08:36:56AM +0200, Daniel Vetter wrote:
> On Mon, Aug 08, 2016 at 08:28:47AM +0100, Chris Wilson wrote:
> > As we do the lockdep protected RCU lookup in a couple of places,
> > refactor that code to a common helper i915_gem_active_raw()..
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_request.h | 21 +++++++++++++++++----
> >  1 file changed, 17 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_request.h b/drivers/gpu/drm/i915/i915_gem_request.h
> > index 3496e28785e7..6dd01cbf4895 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_request.h
> > +++ b/drivers/gpu/drm/i915/i915_gem_request.h
> > @@ -360,6 +360,21 @@ __i915_gem_active_peek(const struct i915_gem_active *active)
> >  }
> >  
> >  /**
> > + * i915_gem_active_raw - return the active request
> > + * @active - the active tracker
> > + *
> > + * i915_gem_active_raw() returns the current request being tracked, or NULL.
> > + * It does not obtain a reference on the request for the caller, so the caller
> > + * must hold struct_mutex.
> > + */
> > +static inline struct drm_i915_gem_request *
> > +i915_gem_active_raw(const struct i915_gem_active *active, struct mutex *mutex)
> 
> There's a rcu_dereference_raw helper which doesn't bother with any lockdep
> checking. A bit confusing naming, otoh I couldn't come up with something
> better.

__i915_gem_active_protected()  ?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list