Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/i915: Speed up idle detection by kicking the tasklets
Date: Mon, 07 May 2018 11:34:24 +0300	[thread overview]
Message-ID: <87h8njyicv.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180506171328.30034-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> We rely on ksoftirqd to run in a timely fashion in order to drain the
> execlists queue. Quite frequently, it does not. In some cases we may see
> latencies of over 200ms triggering our idle timeouts and forcing us to
> declare the driver wedged!
>
> Thus we can speed up idle detection by bypassing ksoftirqd in these
> cases and flush our tasklet to confirm if we are indeed still waiting
> for the ELSP to drain.
>
> v2: Put the execlists.first check back; it is required for handling
> reset!
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 70325e0824e3..a3111511ea1d 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -945,10 +945,19 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
>  		return true;
>  
>  	/* Waiting to drain ELSP? */
> -	if (READ_ONCE(engine->execlists.active))
> -		return false;
> +	if (READ_ONCE(engine->execlists.active)) {
> +		struct intel_engine_execlists *execlists = &engine->execlists;
> +
> +		if (tasklet_trylock(&execlists->tasklet)) {

Now that we have the lock, sample active again to catch
the late tasklet run and skip running if so?

-Mika

> +			execlists->tasklet.func(execlists->tasklet.data);
> +			tasklet_unlock(&execlists->tasklet);
> +		}
> +
> +		if (READ_ONCE(execlists->active))
> +			return false;
> +	}
>  
> -	/* ELSP is empty, but there are ready requests? */
> +	/* ELSP is empty, but there are ready requests? E.g. after reset */
>  	if (READ_ONCE(engine->execlists.first))
>  		return false;
>  
> -- 
> 2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-05-07  8:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
2018-05-06 15:55 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-05-06 16:41 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-05-06 17:13 ` [PATCH v2] " Chris Wilson
2018-05-07  8:34   ` Mika Kuoppala [this message]
2018-05-07  8:38     ` Chris Wilson
2018-05-07  8:54       ` Mika Kuoppala
2018-05-07  9:03         ` Chris Wilson
2018-05-06 17:33 ` ✓ Fi.CI.BAT: success for drm/i915: Speed up idle detection by kicking the tasklets (rev2) Patchwork
2018-05-06 18:17 ` ✓ Fi.CI.IGT: " Patchwork

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=87h8njyicv.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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