From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Subject: Re: [PATCH 4/6] drm/i915/breadcrumbs: Disable interrupt bottom-half first on idling
Date: Wed, 15 Mar 2017 19:33:18 +0000 [thread overview]
Message-ID: <206232e3-6f5b-9eab-ef82-85305cd4af47@linux.intel.com> (raw)
In-Reply-To: <20170315140107.18720-4-chris@chris-wilson.co.uk>
On 15/03/2017 14:01, Chris Wilson wrote:
> Before walking the rbtree of waiters (marking them as complete and waking
> them), decouple the interrupt handler. This prevents a race between the
> missed waiter waking up and removing its intel_wait (which skips
> checking the lock) and the interrupt handler dereferencing the
> intel_wait. (Though we do not expect to encounter waiters during idle!)
>
> Fixes: e1c0c91bdaec ("drm/i915: Wake up all waiters before idling")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/intel_breadcrumbs.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> index 31e7c25013a4..ebcb595001fc 100644
> --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> @@ -179,7 +179,7 @@ void __intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine)
> void intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine)
> {
> struct intel_breadcrumbs *b = &engine->breadcrumbs;
> - struct intel_wait *wait, *n;
> + struct intel_wait *wait, *n, *first;
>
> if (!b->irq_armed)
> return;
> @@ -190,18 +190,19 @@ void intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine)
> */
>
> spin_lock_irq(&b->rb_lock);
> +
> + spin_lock(&b->irq_lock);
> + first = fetch_and_zero(&b->irq_wait);
> + __intel_engine_disarm_breadcrumbs(engine);
> + spin_unlock(&b->irq_lock);
> +
> rbtree_postorder_for_each_entry_safe(wait, n, &b->waiters, node) {
> RB_CLEAR_NODE(&wait->node);
> - if (wake_up_process(wait->tsk) && wait == b->irq_wait)
> + if (wake_up_process(wait->tsk) && wait == first)
> missed_breadcrumb(engine);
> }
> b->waiters = RB_ROOT;
>
> - spin_lock(&b->irq_lock);
> - b->irq_wait = NULL;
> - __intel_engine_disarm_breadcrumbs(engine);
> - spin_unlock(&b->irq_lock);
> -
> spin_unlock_irq(&b->rb_lock);
> }
>
>
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-03-15 19:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 14:01 [PATCH 1/6] drm/i915/breadcrumbs: Use booleans for intel_breadcrumbs_busy() Chris Wilson
2017-03-15 14:01 ` [PATCH 2/6] drm/i915/breadcrumbs: Assert that irqs are disabled as we update the bottom-half Chris Wilson
2017-03-15 18:20 ` Tvrtko Ursulin
2017-03-15 18:32 ` Chris Wilson
2017-03-15 19:01 ` Tvrtko Ursulin
2017-03-15 14:01 ` [PATCH 3/6] drm/i915/breadcrumbs: Update bottom-half before marking as complete Chris Wilson
2017-03-15 18:58 ` Tvrtko Ursulin
2017-03-15 19:10 ` Chris Wilson
2017-03-15 19:30 ` Tvrtko Ursulin
2017-03-15 14:01 ` [PATCH 4/6] drm/i915/breadcrumbs: Disable interrupt bottom-half first on idling Chris Wilson
2017-03-15 19:33 ` Tvrtko Ursulin [this message]
2017-03-15 14:01 ` [PATCH 5/6] drm/i915/breadcrumbs: Assert that we do not shortcut the current bottom-half Chris Wilson
2017-03-15 19:40 ` Tvrtko Ursulin
2017-03-15 14:01 ` [PATCH 6/6] drm/i915: Only attempt to signal the request once from the interrupt handler Chris Wilson
2017-03-15 19:47 ` Tvrtko Ursulin
2017-03-15 20:05 ` Chris Wilson
2017-03-15 20:09 ` Tvrtko Ursulin
2017-03-15 14:52 ` ✓ Fi.CI.BAT: success for series starting with [1/6] drm/i915/breadcrumbs: Use booleans for intel_breadcrumbs_busy() Patchwork
2017-03-15 18:03 ` [PATCH 1/6] " Tvrtko Ursulin
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=206232e3-6f5b-9eab-ef82-85305cd4af47@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@intel.com \
/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