diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-12-13 04:48:02 -0500 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2017-12-14 03:58:59 -0500 |
commit | 2cf654db8d7eafb973d28eb3cddf043d353e1345 (patch) | |
tree | 698cdf1b153e6005f3773f12133b66d4e2ff9348 | |
parent | 74c7b0782b15bc2478f557cea34b3fe34d452dc6 (diff) |
drm/i915/fence: Use rcu to defer freeing of irq_work
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@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171213094802.28243-1-chris@chris-wilson.co.uk
(cherry picked from commit 7d622351c94172a42bfe9b13bdb0fdc2be90ed3b)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_sw_fence.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c index e8ca67a129d2..ac236b88c99c 100644 --- a/drivers/gpu/drm/i915/i915_sw_fence.c +++ b/drivers/gpu/drm/i915/i915_sw_fence.c | |||
@@ -367,6 +367,7 @@ struct i915_sw_dma_fence_cb { | |||
367 | struct dma_fence *dma; | 367 | struct dma_fence *dma; |
368 | struct timer_list timer; | 368 | struct timer_list timer; |
369 | struct irq_work work; | 369 | struct irq_work work; |
370 | struct rcu_head rcu; | ||
370 | }; | 371 | }; |
371 | 372 | ||
372 | static void timer_i915_sw_fence_wake(struct timer_list *t) | 373 | static void timer_i915_sw_fence_wake(struct timer_list *t) |
@@ -406,7 +407,7 @@ static void irq_i915_sw_fence_work(struct irq_work *wrk) | |||
406 | del_timer_sync(&cb->timer); | 407 | del_timer_sync(&cb->timer); |
407 | dma_fence_put(cb->dma); | 408 | dma_fence_put(cb->dma); |
408 | 409 | ||
409 | kfree(cb); | 410 | kfree_rcu(cb, rcu); |
410 | } | 411 | } |
411 | 412 | ||
412 | int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence, | 413 | int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence, |