intel-gfx.lists.freedesktop.org archive mirror
 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 2/7] drm/i915: Only sync tasklets once for recursive reset preparation
Date: Wed, 16 May 2018 17:24:56 +0300	[thread overview]
Message-ID: <877eo3adaf.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180516064741.30912-2-chris@chris-wilson.co.uk>

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

> When setting up reset, we may need to recursively prepare an engine. In
> which case we should only synchronously flush the tasklets on the outer
> most call, the inner calls will then be inside an atomic section where
> the tasklet will never be run (and so the sync will never complete).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 2 +-
>  drivers/gpu/drm/i915/i915_gem.h | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 0dc369a9ec4d..aab1f5e77ae9 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3036,7 +3036,7 @@ i915_gem_reset_prepare_engine(struct intel_engine_cs *engine)
>  	 * Turning off the execlists->tasklet until the reset is over
>  	 * prevents the race.
>  	 */
> -	tasklet_disable(&engine->execlists.tasklet);
> +	__tasklet_disable_once(&engine->execlists.tasklet);

It is debatable that could the naming be improved as
the 'once' is tied to the disable now.

__tasklet_disable_wait_[once|first].

I was going to insist on adding a comment tho,
but there it is already above, explaining
the recursion from set wedged.

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

>  
>  	/*
>  	 * We're using worker to queue preemption requests from the tasklet in
> diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
> index 525920404ede..af033e7c1c56 100644
> --- a/drivers/gpu/drm/i915/i915_gem.h
> +++ b/drivers/gpu/drm/i915/i915_gem.h
> @@ -26,6 +26,7 @@
>  #define __I915_GEM_H__
>  
>  #include <linux/bug.h>
> +#include <linux/interrupt.h>
>  
>  struct drm_i915_private;
>  
> @@ -72,4 +73,10 @@ struct drm_i915_private;
>  void i915_gem_park(struct drm_i915_private *i915);
>  void i915_gem_unpark(struct drm_i915_private *i915);
>  
> +static inline void __tasklet_disable_once(struct tasklet_struct *t)
> +{
> +	if (atomic_inc_return(&t->count) == 1)
> +		tasklet_unlock_wait(t);
> +}
> +
>  #endif /* __I915_GEM_H__ */
> -- 
> 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-16 14:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16  6:47 [PATCH 1/7] drm/i915: Remove tasklet flush before disable Chris Wilson
2018-05-16  6:47 ` [PATCH 2/7] drm/i915: Only sync tasklets once for recursive reset preparation Chris Wilson
2018-05-16 14:24   ` Mika Kuoppala [this message]
2018-05-16 14:29     ` Chris Wilson
2018-05-16  6:47 ` [PATCH 3/7] drm/i915/execlists: Refactor out complete_preempt_context() Chris Wilson
2018-05-16  6:47 ` [PATCH 4/7] drm/i915: Move engine reset prepare/finish to backends Chris Wilson
2018-05-16  6:47 ` [PATCH 5/7] drm/i915: Split execlists/guc reset preparations Chris Wilson
2018-05-16  6:47 ` [PATCH 6/7] drm/i915/execlists: Flush pending preemption events during reset Chris Wilson
2018-05-16 14:24   ` Tvrtko Ursulin
2018-05-16 15:01     ` Chris Wilson
2018-05-16  6:47 ` [PATCH 7/7] drm/i915: Stop parking the signaler around reset Chris Wilson
2018-05-16  9:15   ` Tvrtko Ursulin
2018-05-16  9:25     ` Chris Wilson
2018-05-16  9:49       ` Tvrtko Ursulin
2018-05-16  9:58         ` Chris Wilson
2018-05-16 10:13   ` [PATCH v2] " Chris Wilson
2018-05-16 10:37     ` Tvrtko Ursulin
2018-05-16  7:09 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/7] drm/i915: Remove tasklet flush before disable Patchwork
2018-05-16  7:27 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-16  8:39 ` [PATCH 1/7] " Mika Kuoppala
2018-05-16  8:41   ` Chris Wilson
2018-05-16  9:57     ` Mika Kuoppala
2018-05-16 10:33 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/7] drm/i915: Remove tasklet flush before disable (rev2) Patchwork
2018-05-16 10:48 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-16 14:21 ` ✗ Fi.CI.IGT: failure for series starting with [1/7] drm/i915: Remove tasklet flush before disable Patchwork
2018-05-16 18:26 ` ✗ Fi.CI.IGT: failure for series starting with [1/7] drm/i915: Remove tasklet flush before disable (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-05-16 15:12 [PATCH 1/7] drm/i915: Remove tasklet flush before disable Chris Wilson
2018-05-16 15:12 ` [PATCH 2/7] drm/i915: Only sync tasklets once for recursive reset preparation 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=877eo3adaf.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;
as well as URLs for NNTP newsgroup(s).