All of 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
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: Add a safety submission flush in the heartbeat
Date: Mon, 15 Jun 2020 19:16:30 +0300	[thread overview]
Message-ID: <877dw89ue9.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200615131120.18948-1-chris@chris-wilson.co.uk>

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

> Just in case everything fails (like for example "missed interrupt
> syndrome" on Sandybridge), always flush the submission tasklet from the
> heartbeat. This papers over such issues, but will still appear as a
> second long glitch, and prevents us from detecting it unless we happen
> to be performing a timed test.
>
> v2: We rely on flush_submission() synchronizing with the tasklet on
> another CPU.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/intel_engine_cs.c     | 23 +++++++++----------
>  .../gpu/drm/i915/gt/intel_engine_heartbeat.c  |  3 +++
>  2 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> index d613cf31970c..31049e0bdb57 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> @@ -1094,19 +1094,18 @@ void intel_engine_flush_submission(struct intel_engine_cs *engine)
>  {
>  	struct tasklet_struct *t = &engine->execlists.tasklet;
>  
> -	if (__tasklet_is_scheduled(t)) {
> -		local_bh_disable();
> -		if (tasklet_trylock(t)) {
> -			/* Must wait for any GPU reset in progress. */
> -			if (__tasklet_is_enabled(t))
> -				t->func(t->data);
> -			tasklet_unlock(t);
> -		}
> -		local_bh_enable();
> +	/* Synchronise and wait for the tasklet on another CPU */
> +	tasklet_kill(t);
> +
> +	/* Having cancelled the tasklet, ensure that is run */
> +	local_bh_disable();
> +	if (tasklet_trylock(t)) {
> +		/* Must wait for any GPU reset in progress. */
> +		if (__tasklet_is_enabled(t))

On heartbeat context this could be an assertion I think.

But it is difficult to enforce hw sanity and still please the
user.

They will curse on glitch, even tho thye are saved!

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

-Mika

> +			t->func(t->data);
> +		tasklet_unlock(t);
>  	}
> -
> -	/* Otherwise flush the tasklet if it was running on another cpu */
> -	tasklet_unlock_wait(t);
> +	local_bh_enable();
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> index f67ad937eefb..cd20fb549b38 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> @@ -65,6 +65,9 @@ static void heartbeat(struct work_struct *wrk)
>  	struct intel_context *ce = engine->kernel_context;
>  	struct i915_request *rq;
>  
> +	/* Just in case everything has gone horribly wrong, give it a kick */
> +	intel_engine_flush_submission(engine);
> +
>  	rq = engine->heartbeat.systole;
>  	if (rq && i915_request_completed(rq)) {
>  		i915_request_put(rq);
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-06-15 16:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 12:39 [Intel-gfx] [PATCH 01/10] drm/i915/selftests: Disable preemptive heartbeats over preemption tests Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 02/10] drm/i915/selftests: Dump engine state and trace upon hanging after reset Chris Wilson
2020-06-15 14:33   ` [Intel-gfx] [PATCH] " Chris Wilson
2020-06-15 15:56     ` Mika Kuoppala
2020-06-15 12:39 ` [Intel-gfx] [PATCH 03/10] drm/i915/gt: Add a safety submission flush in the heartbeat Chris Wilson
2020-06-15 13:11   ` [Intel-gfx] [PATCH] " Chris Wilson
2020-06-15 16:16     ` Mika Kuoppala [this message]
2020-06-15 12:39 ` [Intel-gfx] [PATCH 04/10] drm/i915/execlists: Replace direct submit with direct call to tasklet Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 05/10] drm/i915/execlists: Defer schedule_out until after the next dequeue Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 06/10] drm/i915/gt: ce->inflight updates are now serialised Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 07/10] drm/i915/gt: Drop atomic for engine->fw_active tracking Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 08/10] drm/i915/gt: Use virtual_engine during execlists_dequeue Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 09/10] drm/i915/gt: Decouple inflight virtual engines Chris Wilson
2020-06-15 12:39 ` [Intel-gfx] [PATCH 10/10] drm/i915/gt: Resubmit the virtual engine on schedule-out Chris Wilson
2020-06-15 14:03 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915/selftests: Disable preemptive heartbeats over preemption tests (rev2) Patchwork
2020-06-15 14:05 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-06-15 14:26 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-06-15 14:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915/selftests: Disable preemptive heartbeats over preemption tests (rev3) Patchwork
2020-06-15 14:56 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-06-15 15:20 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-06-15 15:29 ` [Intel-gfx] [PATCH 01/10] drm/i915/selftests: Disable preemptive heartbeats over preemption tests Mika Kuoppala

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=877dw89ue9.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 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.