[Intel-gfx] [PATCH 1/2] drm/i915: Initialise the obj->rcu head

Chris Wilson chris at chris-wilson.co.uk
Fri Nov 9 09:00:59 UTC 2018


Quoting Mika Kuoppala (2018-11-09 08:40:56)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > Make the rcu_head known to the system, in particular for debugobjects.
> > And having declared it for debugobjects, we need to tidy up afterwards.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108691
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 5b80b0c14aed..24f126ccf21e 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -4739,6 +4739,8 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
> >       INIT_LIST_HEAD(&obj->lut_list);
> >       INIT_LIST_HEAD(&obj->batch_pool_link);
> >  
> > +     init_rcu_head(&obj->rcu);
> > +
> >       obj->ops = ops;
> >  
> >       reservation_object_init(&obj->__builtin_resv);
> > @@ -4941,6 +4943,8 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
> >               drm_gem_object_release(&obj->base);
> >               i915_gem_info_remove_obj(i915, obj->base.size);
> >  
> > +             destroy_rcu_head(&obj->rcu);
> > +
> 
> It looks like you need to break the union in struct drm_i915_gem_object
> for this to work. Or did I get the ordering of events wrong?

Not the ordering of events, just the insensitivity of debugobjects. All
we are saying here is to remove the hash of this pointer from the set
of debugobjects so that when this memory block is freed we do not
complain that the debugobject still exists. To address the complaint, we
can just move to where the rcu transitions to being the llist, which I
had forgotten about.
-Chris


More information about the Intel-gfx mailing list