From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Use rcu to defer freeing of irq_work
Date: Wed, 13 Dec 2017 10:54:55 +0000 [thread overview]
Message-ID: <05082d5a-7bf7-84b0-d7a6-cc5ebd73429c@linux.intel.com> (raw)
In-Reply-To: <20171213094802.28243-1-chris@chris-wilson.co.uk>
On 13/12/2017 09:48, 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@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_sw_fence.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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 {
> struct dma_fence *dma;
> struct timer_list timer;
> struct irq_work work;
> + struct rcu_head rcu;
> };
>
> 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)
> del_timer_sync(&cb->timer);
> dma_fence_put(cb->dma);
>
> - kfree(cb);
> + kfree_rcu(cb, rcu);
> }
>
> int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-12-13 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 9:48 [PATCH] drm/i915: Use rcu to defer freeing of irq_work Chris Wilson
2017-12-13 10:19 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-12-13 10:54 ` Tvrtko Ursulin [this message]
2017-12-13 12:02 ` [PATCH] " Chris Wilson
2017-12-13 11:50 ` ✓ Fi.CI.IGT: success for " Patchwork
2017-12-13 11:58 ` Chris Wilson
2017-12-13 12:34 ` [PATCH] " Joonas Lahtinen
2017-12-13 12:43 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=05082d5a-7bf7-84b0-d7a6-cc5ebd73429c@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox