[Intel-gfx] [PATCH] drm/i915: Use rcu to defer freeing of irq_work

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 13 12:43:10 UTC 2017


Quoting Joonas Lahtinen (2017-12-13 12:34:10)
> On Wed, 2017-12-13 at 09:48 +0000, Chris Wilson wrote:
> > It is illegal to perform an immediate free of the struct irq_work from
> > inside the irq_work callback (as irq_work_run_list modifies work->flags
> > after execution of the work->func()). As we use the irq_work to
> > coordinate the freeing of the callback from two different softirq paths,
> > we need to defer the kfree from inside our irq_work callback, for which
> > we can use kfree_rcu.
> > 
> > Fixes: 81c0ed21aa91 ("drm/i915/fence: Avoid del_timer_sync() from inside a timer")
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> 
> <SNIP>
> 
> > @@ -367,6 +367,7 @@ struct i915_sw_dma_fence_cb {
> >       struct dma_fence *dma;
> >       struct timer_list timer;
> >       struct irq_work work;
> > +     struct rcu_head rcu;
> 
> To reduce the chances of hitting the 4095 limit, maybe throw this right
> after the base? OTOH, it'll yell if it breaks...

Yup, and for the moment, the accidental increment of workarounds is
providing some merriment.
-Chris


More information about the Intel-gfx mailing list