drm/i915: Construct a request even if the GPU is currently hung
Subsystems (2)
PATCH 1/2 drm/i915: Construct a request even if the GPU is currently hung
As we now have the ability to directly reset the GPU from the waiter (and so do not need to drop the lock in order to let the reset proceed) and also do not lose requests over a reset, we can now simply queue the request to occur after the reset rather than roundtripping to userspace (or worse failing with EIO).
--- drivers/gpu/drm/i915/i915_gem_request.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/i915_gem_request.c +3 -25
@@ -307,26 +307,6 @@ void i915_gem_request_retire_upto(struct drm_i915_gem_request *req) }while (tmp != req); } -static int i915_gem_check_wedge (struct drm_i915_private *dev_priv) -{ -struct i915_gpu_error *error = &dev_priv->gpu_error; - -if (i915_terminally_wedged (error)) -return -EIO ; - -if (i915_reset_in_progress (error)) { -/* Non-interruptible callers can't handle -EAGAIN, hence return -* -EIO unconditionally for these. -*/ -if (!dev_priv->mm.interruptible) -return -EIO ; - -return -EAGAIN ; - } - -return 0 ; -} -static int i915_gem_init_global_seqno (struct drm_i915_private *i915,u32 seqno) {struct i915_gem_timeline *timeline = &i915->gt.global_timeline;
@@ -521,12 +501,10 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,lockdep_assert_held (&dev_priv->drm.struct_mutex);/* ABI: Before userspace accesses the GPU (e.g. execbuffer), report -* EIO if the GPU is already wedged, or EAGAIN to drop the struct_mutex -* and restart. +* EIO if the GPU is already wedged. */ - ret =i915_gem_check_wedge (dev_priv); -if (ret) -return ERR_PTR (ret); +if (i915_terminally_wedged (&dev_priv->gpu_error)) +return ERR_PTR (-EIO );/* Pinning the contexts may generate requests in order to acquire * GGTT space, so do this first before we reserve a seqno for
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Skip switch to kernel context if already done
Some engines are never user or already sitting idle in the kernel context and for those we can skip flushing the current context for i915_gem_switch_to_kernel_context(). We used to perform this optimisation but that was removed for convenience of converting over to multiple timelines and handling the pending request queues.
From the perspective of writing selftests, reducing the number of background operations on the engines makes defining assertions easier.
--- drivers/gpu/drm/i915/i915_gem.c | 3 ++- drivers/gpu/drm/i915/i915_gem_context.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +2 -1
@@ -4144,7 +4144,8 @@ static void assert_kernel_context_is_current(struct drm_i915_private *dev_priv)enum intel_engine_id id;for_each_engine (engine, dev_priv, id) -GEM_BUG_ON (!i915_gem_context_is_kernel (engine->last_retired_context)); +GEM_BUG_ON (!(engine->last_retired_context ==NULL || +i915_gem_context_is_kernel (engine->last_retired_context))); }int i915_gem_suspend (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_gem_context.c +25 -0
@@ -897,6 +897,26 @@ int i915_switch_context(struct drm_i915_gem_request *req)return do_rcs_switch (req); } +static bool engine_has_kernel_context (struct intel_engine_cs *engine) +{ +struct i915_gem_timeline *timeline; + +list_for_each_entry (timeline, &engine->i915->gt.timelines, link) { +struct intel_timeline *tl; + +if (timeline == &engine->i915->gt.global_timeline) +continue ; + + tl = &timeline->engine[engine->id]; +if (i915_gem_active_peek (&tl->last_request, + &engine->i915->drm.struct_mutex)) +return false; + } + +return (engine->last_retired_context ==NULL || +i915_gem_context_is_kernel (engine->last_retired_context)); +} +int i915_gem_switch_to_kernel_context (struct drm_i915_private *dev_priv) {struct intel_engine_cs *engine;
@@ -905,10 +925,15 @@ int i915_gem_switch_to_kernel_context(struct drm_i915_private *dev_priv)lockdep_assert_held (&dev_priv->drm.struct_mutex); +i915_gem_retire_requests (dev_priv); +for_each_engine (engine, dev_priv, id) {struct drm_i915_gem_request *req;int ret; +if (engine_has_kernel_context (engine)) +continue ; + req =i915_gem_request_alloc (engine, dev_priv->kernel_context);if (IS_ERR (req))return PTR_ERR (req);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Construct a request even if the GPU is currently hung
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Construct a request even if the GPU is currently hung
URL : https://patchwork.freedesktop.org/series/17757/
State : success
== Summary ==
Series 17757v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/17757/revisions/1/mbox/
fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:222 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2600 total:246 pass:214 dwarn:0 dfail:0 fail:0 skip:32
fi-snb-2520m failed to collect. IGT log at Patchwork_3464/fi-snb-2520m/igt.log
c62efbc038f1f9145cd4646f057a30258ab0512c drm-tip: 2017y-01m-10d-12h-32m-20s UTC integration manifest c806282 drm/i915: Skip switch to kernel context if already done
73e237f drm/i915: Construct a request even if the GPU is currently hung
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3464/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx