drm/i915: Distinguish last emitted request from last submitted request
Subsystems (2)
PATCH 1/4 drm/i915: Distinguish last emitted request from last submitted request
In order not to trigger hangcheck on a idle-but-waiting engine, we need to distinguish between the pending request queue and the actual execution queue. This is done later in "drm/i915: Enable multiple timelines" but for now we need a temporary fix to prevent blaming the wrong engine for a GPU hang.
(Note that this causes a temporary subtle change in how we decide when to allow a waitboost to be re-awarded back to the waiter, the temporary effect is that if the wait is upon the most current execution the wait is given for free, instead of checking to see if the client stalled itself. This will be repaired in "drm/i915: Enable multiple timelines".)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98104
--- drivers/gpu/drm/i915/i915_gem_request.c | 5 +++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_request.c +3 -2
@@ -328,6 +328,7 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)switch (state) {case FENCE_COMPLETE : + request->engine->last_submitted_seqno = request->fence.seqno; request->engine->submit_request (request);break ;
@@ -641,8 +642,8 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) &request->submitq); request->emitted_jiffies = jiffies; - request->previous_seqno = engine->last_submitted_seqno; - engine->last_submitted_seqno = request->fence.seqno; + request->previous_seqno = engine->last_pending_seqno; + engine->last_pending_seqno = request->fence.seqno;i915_gem_active_set (&engine->last_request, request);list_add_tail (&request->link, &engine->request_list);list_add_tail (&request->ring_link, &ring->request_list);
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -0
@@ -355,6 +355,7 @@ struct intel_engine_cs {* inspecting request list. */ u32 last_submitted_seqno; +u32 last_pending_seqno;/* An RCU guarded pointer to the last request. No reference is * held to the request, users must carefully acquire a reference to
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/4 drm/i915: Force relocations via cpu if we run out of idle aperture
If we run out of enough aperture space to fit the entire object, we fallback to trying to insert a single page. However, if that also fails, we currently fail to userspace with an unexpected ENOSPC. (ENOSPC means to userspace that their batch could not be fitted within the GTT.) Prior to commit e8cb909ac3ab ("drm/i915: Fallback to single page GTT mmappings for relocations") the approach is to fallback to using the slow CPU relocation path in case of iomapping failure, and that is the behaviour we need to restore.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98101
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -2
@@ -451,8 +451,8 @@ static void *reloc_iomap(struct drm_i915_gem_object *obj,0 , ggtt->mappable_end,DRM_MM_SEARCH_DEFAULT , DRM_MM_CREATE_DEFAULT); -if (ret) -return ERR_PTR (ret); +if (ret)/* no inactive aperture space, use cpu reloc */ +return NULL ; }else { ret =i915_vma_put_fence (vma);if (ret) {
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/4 drm/i915: Reset the breadcrumbs IRQ more carefully
In reply to Chris WilsonAlong with the interrupt, we want to restore the fake-irq and wait-timeout detection. If we use the breadcrumbs interface to setup the interrupt as it wants, the auxiliary timers will also be restored.
v2: Cancel both timers as well, sanitize the IMR.
--- drivers/gpu/drm/i915/intel_breadcrumbs.c | 33 ++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_engine_cs.c | 15 --------------- drivers/gpu/drm/i915/intel_lrc.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- 5 files changed, 34 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_breadcrumbs.c +31 -2
@@ -578,6 +578,36 @@ int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine)return 0 ; } +static void cancel_fake_irq (struct intel_engine_cs *engine) +{ +struct intel_breadcrumbs *b = &engine->breadcrumbs; + +del_timer_sync (&b->hangcheck); +del_timer_sync (&b->fake_irq); +clear_bit (engine->id, &engine->i915->gpu_error.missed_irq_rings); +} + +void intel_engine_reset_breadcrumbs (struct intel_engine_cs *engine) +{ +struct intel_breadcrumbs *b = &engine->breadcrumbs; + +cancel_fake_irq (engine); +spin_lock (&b->lock); + +__intel_breadcrumbs_disable_irq (b); +if (intel_engine_has_waiter (engine)) { + b->timeout =wait_timeout (); +__intel_breadcrumbs_enable_irq (b); +if (READ_ONCE (b->irq_posted)) +wake_up_process (b->first_wait->tsk); + }else { +/* sanitize the IMR and unmask any auxiliary interrupts */ +irq_disable (engine); + } + +spin_unlock (&b->lock); +} +void intel_engine_fini_breadcrumbs (struct intel_engine_cs *engine) {struct intel_breadcrumbs *b = &engine->breadcrumbs;
@@ -585,8 +615,7 @@ void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine)if (!IS_ERR_OR_NULL (b->signaler))kthread_stop (b->signaler); -del_timer_sync (&b->hangcheck); -del_timer_sync (&b->fake_irq); +cancel_fake_irq (engine); }unsigned int intel_kick_waiters (struct drm_i915_private *i915)
drivers/gpu/drm/i915/intel_engine_cs.c +0 -15
@@ -210,9 +210,6 @@ void intel_engine_init_seqno(struct intel_engine_cs *engine, u32 seqno)void intel_engine_init_hangcheck (struct intel_engine_cs *engine) {memset (&engine->hangcheck,0 ,sizeof (engine->hangcheck)); -clear_bit (engine->id, &engine->i915->gpu_error.missed_irq_rings); -if (intel_engine_has_waiter (engine)) -i915_queue_hangcheck (engine->i915); }static void intel_engine_init_requests (struct intel_engine_cs *engine)
@@ -307,18 +304,6 @@ int intel_engine_init_common(struct intel_engine_cs *engine)return 0 ; } -void intel_engine_reset_irq (struct intel_engine_cs *engine) -{ -struct drm_i915_private *dev_priv = engine->i915; - -spin_lock_irq (&dev_priv->irq_lock); -if (intel_engine_has_waiter (engine)) - engine->irq_enable (engine); -else - engine->irq_disable (engine); -spin_unlock_irq (&dev_priv->irq_lock); -} -/** * intel_engines_cleanup_common - cleans up the engine state created by * the common initiailizers.
drivers/gpu/drm/i915/intel_lrc.c +1 -1
@@ -1230,7 +1230,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)lrc_init_hws (engine); -intel_engine_reset_irq (engine); +intel_engine_reset_breadcrumbs (engine);I915_WRITE (RING_HWSTAM (engine->mmio_base),0xffffffff );
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -1
@@ -548,7 +548,7 @@ static int init_ring_common(struct intel_engine_cs *engine)else intel_ring_setup_status_page (engine); -intel_engine_reset_irq (engine); +intel_engine_reset_breadcrumbs (engine);/* Enforce ordering by reading HEAD register back */ I915_READ_HEAD (engine);
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -1
@@ -520,7 +520,6 @@ int __intel_ring_space(int head, int tail, int size);void intel_ring_update_space (struct intel_ring *ring);void intel_engine_init_seqno (struct intel_engine_cs *engine,u32 seqno); -void intel_engine_reset_irq (struct intel_engine_cs *engine);void intel_engine_setup_common (struct intel_engine_cs *engine);int intel_engine_init_common (struct intel_engine_cs *engine);
@@ -614,6 +613,7 @@ static inline bool intel_engine_wakeup(const struct intel_engine_cs *engine)return wakeup; } +void intel_engine_reset_breadcrumbs (struct intel_engine_cs *engine);void intel_engine_fini_breadcrumbs (struct intel_engine_cs *engine);unsigned int intel_kick_waiters (struct drm_i915_private *i915);unsigned int intel_kick_signalers (struct drm_i915_private *i915);
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/4 drm/i915/guc: Unwind GuC workqueue reservation if request construction fails
In reply to Chris WilsonWe reserve space in the GuC workqueue for submitting the request in the future. However, if we fail to construct the request, we need to give that reserved space back to the system.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97978
--- drivers/gpu/drm/i915/i915_guc_submission.c | 12 ++++++++++++ drivers/gpu/drm/i915/intel_guc.h | 1 + drivers/gpu/drm/i915/intel_lrc.c | 17 ++++++++++------- 3 files changed, 23 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +12 -0
@@ -451,6 +451,18 @@ int i915_guc_wq_reserve(struct drm_i915_gem_request *request)return ret; } +void i915_guc_wq_unreserve (struct drm_i915_gem_request *request) +{ +const size_t wqi_size =sizeof (struct guc_wq_item ); +struct i915_guc_client *gc = request->i915->guc.execbuf_client; + +GEM_BUG_ON (READ_ONCE (gc->wq_rsvd) < wqi_size); + +spin_lock (&gc->wq_lock); + gc->wq_rsvd -= wqi_size; +spin_unlock (&gc->wq_lock); +} +/* Construct a Work Item and append it to the GuC's Work Queue */ static void guc_wq_item_append (struct i915_guc_client *gc,struct drm_i915_gem_request *rq)
drivers/gpu/drm/i915/intel_guc.h +1 -0
@@ -160,6 +160,7 @@ extern int intel_guc_resume(struct drm_device *dev);int i915_guc_submission_init (struct drm_i915_private *dev_priv);int i915_guc_submission_enable (struct drm_i915_private *dev_priv);int i915_guc_wq_reserve (struct drm_i915_gem_request *rq); +void i915_guc_wq_unreserve (struct drm_i915_gem_request *request);void i915_guc_submission_disable (struct drm_i915_private *dev_priv);void i915_guc_submission_fini (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_lrc.c +10 -7
@@ -626,6 +626,10 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request request->ring = ce->ring; + ret =intel_lr_context_pin (request->ctx, engine); +if (ret) +return ret; +if (i915.enable_guc_submission) {/* * Check that the GuC has space for the request before
@@ -634,21 +638,17 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request*/ ret =i915_guc_wq_reserve (request);if (ret) -return ret; + goto err_unpin; } - ret =intel_lr_context_pin (request->ctx, engine); -if (ret) -return ret; - ret =intel_ring_begin (request,0 );if (ret) - goto err_unpin; + goto err_unreserve;if (!ce->initialised) { ret = engine->init_context (request);if (ret) - goto err_unpin; + goto err_unreserve; ce->initialised = true; }
@@ -663,6 +663,9 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request request->reserved_space -=EXECLISTS_REQUEST_SIZE ;return 0 ; +err_unreserve: +if (i915.enable_guc_submission) +i915_guc_wq_unreserve (request); err_unpin:intel_lr_context_unpin (request->ctx, engine);return ret;
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for series starting with [CI,1/4] drm/i915: Distinguish last emitted request from last submitted request
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [CI,1/4] drm/i915: Distinguish last emitted request from last submitted request
URL : https://patchwork.freedesktop.org/series/13426/
State : warning
== Summary ==
Series 13426v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/13426/revisions/1/mbox/
Test drv_module_reload_basic:
pass -> DMESG-WARN (fi-bsw-n3050)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
dmesg-warn -> PASS (fi-byt-j1900)
pass -> DMESG-WARN (fi-ilk-650)
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (fi-byt-j1900)
Test vgem_basic:
Subgroup unload:
pass -> SKIP (fi-bsw-n3050)
skip -> PASS (fi-byt-n2820)
skip -> PASS (fi-skl-6700k)
skip -> PASS (fi-ivb-3520m)
skip -> PASS (fi-hsw-4770)
skip -> PASS (fi-hsw-4770r)fi-bdw-5557u total:248 pass:231 dwarn:0 dfail:0 fail:0 skip:17 fi-bsw-n3050 total:248 pass:203 dwarn:1 dfail:0 fail:0 skip:44 fi-bxt-t5700 total:248 pass:217 dwarn:0 dfail:0 fail:0 skip:31 fi-byt-j1900 total:248 pass:214 dwarn:1 dfail:0 fail:1 skip:32 fi-byt-n2820 total:248 pass:211 dwarn:0 dfail:0 fail:1 skip:36 fi-hsw-4770 total:248 pass:225 dwarn:0 dfail:0 fail:0 skip:23 fi-hsw-4770r total:248 pass:225 dwarn:0 dfail:0 fail:0 skip:23 fi-ilk-650 total:248 pass:183 dwarn:1 dfail:0 fail:2 skip:62 fi-ivb-3520m total:248 pass:222 dwarn:0 dfail:0 fail:0 skip:26 fi-ivb-3770 total:248 pass:207 dwarn:0 dfail:0 fail:0 skip:41 fi-kbl-7200u total:248 pass:222 dwarn:0 dfail:0 fail:0 skip:26 fi-skl-6260u total:248 pass:232 dwarn:0 dfail:0 fail:0 skip:16 fi-skl-6700hq total:248 pass:224 dwarn:0 dfail:0 fail:0 skip:24 fi-skl-6700k total:248 pass:222 dwarn:1 dfail:0 fail:0 skip:25 fi-skl-6770hq total:248 pass:231 dwarn:1 dfail:0 fail:1 skip:15 fi-snb-2520m total:248 pass:211 dwarn:0 dfail:0 fail:0 skip:37 fi-snb-2600 total:248 pass:209 dwarn:0 dfail:0 fail:0 skip:39
Results at /archive/results/CI_IGT_test/Patchwork_2644/
dcdd1fd23b37325fa6087ecc3309b66a9049ce95 drm-intel-nightly: 2016y-10m-06d-18h-31m-14s UTC integration manifest d8e734c drm/i915/guc: Unwind GuC workqueue reservation if request construction fails
4f1475b drm/i915: Reset the breadcrumbs IRQ more carefully
28af61b drm/i915: Force relocations via cpu if we run out of idle aperture
088b362 drm/i915: Distinguish last emitted request from last submitted request
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for series starting with [CI,1/4] drm/i915: Distinguish last emitted request from last submitted request
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [CI,1/4] drm/i915: Distinguish last emitted request from last submitted request
URL : https://patchwork.freedesktop.org/series/13426/
State : warning
== Summary ==
Series 13426v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/13426/revisions/1/mbox/
Test drv_module_reload_basic:
pass -> DMESG-WARN (fi-bsw-n3050)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
dmesg-warn -> PASS (fi-byt-j1900)
pass -> DMESG-WARN (fi-ilk-650)
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (fi-byt-j1900)
Test vgem_basic:
Subgroup unload:
skip -> PASS (fi-ivb-3520m)
pass -> SKIP (fi-bsw-n3050)
skip -> PASS (fi-byt-n2820)
skip -> PASS (fi-hsw-4770)
skip -> PASS (fi-hsw-4770r)
skip -> PASS (fi-skl-6700k)fi-bdw-5557u total:248 pass:231 dwarn:0 dfail:0 fail:0 skip:17 fi-bsw-n3050 total:248 pass:203 dwarn:1 dfail:0 fail:0 skip:44 fi-bxt-t5700 total:248 pass:217 dwarn:0 dfail:0 fail:0 skip:31 fi-byt-j1900 total:248 pass:214 dwarn:1 dfail:0 fail:1 skip:32 fi-byt-n2820 total:248 pass:211 dwarn:0 dfail:0 fail:1 skip:36 fi-hsw-4770 total:248 pass:225 dwarn:0 dfail:0 fail:0 skip:23 fi-hsw-4770r total:248 pass:225 dwarn:0 dfail:0 fail:0 skip:23 fi-ilk-650 total:248 pass:183 dwarn:1 dfail:0 fail:2 skip:62 fi-ivb-3520m total:248 pass:222 dwarn:0 dfail:0 fail:0 skip:26 fi-ivb-3770 total:248 pass:207 dwarn:0 dfail:0 fail:0 skip:41 fi-kbl-7200u total:248 pass:222 dwarn:0 dfail:0 fail:0 skip:26 fi-skl-6260u total:248 pass:232 dwarn:0 dfail:0 fail:0 skip:16 fi-skl-6700hq total:248 pass:224 dwarn:0 dfail:0 fail:0 skip:24 fi-skl-6700k total:248 pass:222 dwarn:1 dfail:0 fail:0 skip:25 fi-skl-6770hq total:248 pass:231 dwarn:1 dfail:0 fail:1 skip:15 fi-snb-2520m total:248 pass:211 dwarn:0 dfail:0 fail:0 skip:37 fi-snb-2600 total:248 pass:209 dwarn:0 dfail:0 fail:0 skip:39
Results at /archive/results/CI_IGT_test/Patchwork_2644/
dcdd1fd23b37325fa6087ecc3309b66a9049ce95 drm-intel-nightly: 2016y-10m-06d-18h-31m-14s UTC integration manifest d8e734c drm/i915/guc: Unwind GuC workqueue reservation if request construction fails
4f1475b drm/i915: Reset the breadcrumbs IRQ more carefully
28af61b drm/i915: Force relocations via cpu if we run out of idle aperture
088b362 drm/i915: Distinguish last emitted request from last submitted request
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx