* [PATCH] drm/i915: Prevent timeline updates whilst performing reset
@ 2016-12-19 14:56 Chris Wilson
2016-12-19 15:15 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-12-22 12:41 ` [PATCH] " Mika Kuoppala
0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2016-12-19 14:56 UTC (permalink / raw)
To: intel-gfx; +Cc: drm-intel-fixes
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>
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* ✓ Fi.CI.BAT: success for drm/i915: Prevent timeline updates whilst performing reset
2016-12-19 14:56 [PATCH] drm/i915: Prevent timeline updates whilst performing reset Chris Wilson
@ 2016-12-19 15:15 ` Patchwork
2016-12-22 12:41 ` [PATCH] " Mika Kuoppala
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2016-12-19 15:15 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Prevent timeline updates whilst performing reset
URL : https://patchwork.freedesktop.org/series/16998/
State : success
== Summary ==
Series 16998v1 drm/i915: Prevent timeline updates whilst performing reset
https://patchwork.freedesktop.org/api/1.0/series/16998/revisions/1/mbox/
fi-bdw-5557u total:247 pass:233 dwarn:0 dfail:0 fail:0 skip:14
fi-bsw-n3050 total:247 pass:208 dwarn:0 dfail:0 fail:0 skip:39
fi-bxt-j4205 total:247 pass:225 dwarn:1 dfail:0 fail:0 skip:21
fi-bxt-t5700 total:247 pass:220 dwarn:0 dfail:0 fail:0 skip:27
fi-byt-j1900 total:247 pass:220 dwarn:0 dfail:0 fail:0 skip:27
fi-byt-n2820 total:247 pass:216 dwarn:0 dfail:0 fail:0 skip:31
fi-hsw-4770 total:247 pass:228 dwarn:0 dfail:0 fail:0 skip:19
fi-hsw-4770r total:247 pass:228 dwarn:0 dfail:0 fail:0 skip:19
fi-ilk-650 total:247 pass:195 dwarn:0 dfail:0 fail:0 skip:52
fi-ivb-3520m total:247 pass:226 dwarn:0 dfail:0 fail:0 skip:21
fi-ivb-3770 total:247 pass:226 dwarn:0 dfail:0 fail:0 skip:21
fi-kbl-7500u total:247 pass:226 dwarn:0 dfail:0 fail:0 skip:21
fi-skl-6260u total:247 pass:234 dwarn:0 dfail:0 fail:0 skip:13
fi-skl-6700hq total:247 pass:227 dwarn:0 dfail:0 fail:0 skip:20
fi-skl-6700k total:247 pass:224 dwarn:3 dfail:0 fail:0 skip:20
fi-skl-6770hq total:247 pass:234 dwarn:0 dfail:0 fail:0 skip:13
fi-snb-2520m total:247 pass:216 dwarn:0 dfail:0 fail:0 skip:31
fi-snb-2600 total:247 pass:215 dwarn:0 dfail:0 fail:0 skip:32
cda2d70a4395323bcf064c81ee0f89d2de015544 drm-tip: 2016y-12m-19d-13h-00m-10s UTC integration manifest
c075aaa drm/i915: Prevent timeline updates whilst performing reset
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3330/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/i915: Prevent timeline updates whilst performing reset
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
1 sibling, 0 replies; 3+ messages in thread
From: Mika Kuoppala @ 2016-12-22 12:41 UTC (permalink / raw)
To: Chris Wilson, intel-gfx; +Cc: drm-intel-fixes
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-22 12:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] " Mika Kuoppala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox