All of lore.kernel.org
 help / color / mirror / Atom feed
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: Always double check for a missed interrupt for new bottom halves
Date: Tue, 5 Jul 2016 14:38:55 +0100	[thread overview]
Message-ID: <577BB86F.3040906@linux.intel.com> (raw)
In-Reply-To: <1467718145-22437-1-git-send-email-chris@chris-wilson.co.uk>


On 05/07/16 12:29, Chris Wilson wrote:
> After assigning ourselves as the new bottom-half, we must perform a
> cursory check to prevent a missed interrupt.  Either we miss the interrupt
> whilst programming the hardware, or if there was a previous waiter (for
> a later seqno) they may be woken instead of us (due to the inherent race
> in the unlocked read of b->tasklet in the irq handler) and so we miss the
> wake up.
>
> Spotted-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_breadcrumbs.c | 16 +++++++++++-----
>   1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> index 009d6e1..6fcbb52 100644
> --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> @@ -65,7 +65,7 @@ static void irq_disable(struct intel_engine_cs *engine)
>   	engine->irq_posted = false;
>   }
>
> -static bool __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
> +static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
>   {
>   	struct intel_engine_cs *engine =
>   		container_of(b, struct intel_engine_cs, breadcrumbs);
> @@ -73,7 +73,7 @@ static bool __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
>
>   	assert_spin_locked(&b->lock);
>   	if (b->rpm_wakelock)
> -		return false;
> +		return;
>
>   	/* Since we are waiting on a request, the GPU should be busy
>   	 * and should have its own rpm reference. For completeness,
> @@ -93,8 +93,6 @@ static bool __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
>   	if (!b->irq_enabled ||
>   	    test_bit(engine->id, &i915->gpu_error.missed_irq_rings))
>   		mod_timer(&b->fake_irq, jiffies + 1);
> -
> -	return engine->irq_posted;
>   }
>
>   static void __intel_breadcrumbs_disable_irq(struct intel_breadcrumbs *b)
> @@ -233,7 +231,15 @@ static bool __intel_engine_add_wait(struct intel_engine_cs *engine,
>   		GEM_BUG_ON(rb_first(&b->waiters) != &wait->node);
>   		b->first_wait = wait;
>   		smp_store_mb(b->tasklet, wait->tsk);
> -		first = __intel_breadcrumbs_enable_irq(b);
> +		/* After assigning ourselves as the new bottom-half, we must
> +		 * perform a cursory check to prevent a missed interrupt.
> +		 * Either we miss the interrupt whilst programming the hardware,
> +		 * or if there was a previous waiter (for a later seqno) they
> +		 * may be woken instead of us (due to the inherent race
> +		 * in the unlocked read of b->tasklet in the irq handler) and
> +		 * so we miss the wake up.
> +		 */
> +		__intel_breadcrumbs_enable_irq(b);
>   	}
>   	GEM_BUG_ON(!b->tasklet);
>   	GEM_BUG_ON(!b->first_wait);

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

  parent reply	other threads:[~2016-07-05 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 11:29 [PATCH] drm/i915: Always double check for a missed interrupt for new bottom halves Chris Wilson
2016-07-05 11:55 ` Chris Wilson
2016-07-05 12:02 ` ✗ Ro.CI.BAT: warning for " Patchwork
2016-07-05 13:38 ` Tvrtko Ursulin [this message]
2016-07-05 15:04   ` [PATCH] " 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=577BB86F.3040906@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.