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: drm-intel-fixes@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Prevent timeline updates whilst performing reset
Date: Thu, 22 Dec 2016 14:41:27 +0200	[thread overview]
Message-ID: <87bmw43zm0.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20161219145643.15850-1-chris@chris-wilson.co.uk>

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

> As the fence may be signaled concurrently from an interrupt on another
> device, it is possible for the list of requests on the timeline to be
> modified as we walk it. Take both (the context's timeline and the global
> timeline) locks to prevent such modifications.
>
> Fixes: 80b204bce8f2 ("drm/i915: Enable multiple timelines")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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

> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: <drm-intel-fixes@lists.freedesktop.org>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 2d736442c6ab..d94df127d9f6 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2725,6 +2725,7 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
>  	struct drm_i915_gem_request *request;
>  	struct i915_gem_context *incomplete_ctx;
>  	struct intel_timeline *timeline;
> +	unsigned long flags;
>  	bool ring_hung;
>  
>  	if (engine->irq_seqno_barrier)
> @@ -2768,13 +2769,20 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
>  	if (i915_gem_context_is_default(incomplete_ctx))
>  		return;
>  
> +	timeline = i915_gem_context_lookup_timeline(incomplete_ctx, engine);
> +
> +	spin_lock_irqsave(&engine->timeline->lock, flags);
> +	spin_lock(&timeline->lock);
> +
>  	list_for_each_entry_continue(request, &engine->timeline->requests, link)
>  		if (request->ctx == incomplete_ctx)
>  			reset_request(request);
>  
> -	timeline = i915_gem_context_lookup_timeline(incomplete_ctx, engine);
>  	list_for_each_entry(request, &timeline->requests, link)
>  		reset_request(request);
> +
> +	spin_unlock(&timeline->lock);
> +	spin_unlock_irqrestore(&engine->timeline->lock, flags);
>  }
>  
>  void i915_gem_reset(struct drm_i915_private *dev_priv)
> -- 
> 2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2016-12-22 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 14:56 [PATCH] drm/i915: Prevent timeline updates whilst performing reset Chris Wilson
2016-12-19 15:15 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-12-22 12:41 ` Mika Kuoppala [this message]

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=87bmw43zm0.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=drm-intel-fixes@lists.freedesktop.org \
    --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.