drm/i915: Bump wait-times for the final CS interrupt before parking
Subsystems (2)
PATCH 1/2 drm/i915: Bump wait-times for the final CS interrupt before parking
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the struct_mutex to avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.
--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +20 -11
@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;
@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); +do { +if (READ_ONCE (dev_priv->gt.active_requests) || +work_pending (work)) +return ; + +if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end)); rearm_hangcheck =cancel_delayed_work_sync (&dev_priv->gpu_error.hangcheck_work); -if (!mutex_trylock (&dev->struct_mutex)) { +if (!mutex_trylock (&dev_priv->drm.struct_mutex)) {/* Currently busy, come back later */ mod_delayed_work(dev_priv->wq, &dev_priv->gt.idle_work,
@@ -3310,13 +3318,14 @@ i915_gem_idle_work_handler(struct work_struct *work)* New request retired after this work handler started, extend active * period until next instance of the work. */ -if (work_pending (work)) +if (dev_priv->gt.active_requests ||work_pending (work)) goto out_unlock; -if (dev_priv->gt.active_requests) - goto out_unlock; - -if (wait_for (intel_engines_are_idle (dev_priv),10 )) +/* +* We are committed now to parking the engines, make sure there +* will be no more interrupts arriving later. +*/ +if (!intel_engines_are_idle (dev_priv))DRM_ERROR ("Timeout waiting for engines to idle\n" );intel_engines_mark_idle (dev_priv);
@@ -3330,7 +3339,7 @@ i915_gem_idle_work_handler(struct work_struct *work)gen6_rps_idle (dev_priv);intel_runtime_pm_put (dev_priv); out_unlock: -mutex_unlock (&dev->struct_mutex); +mutex_unlock (&dev_priv->drm.struct_mutex); out_rearm:if (rearm_hangcheck) {
Signature · 6 lines
2.15.0.rc1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Filter out spurious execlists context-switch interrupts
Back in commit a4b2b01523a8 ("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commit beecec901790 ("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a counter for the expected number of pending context-switches and skip if we do not need to handle this interrupt to make forward progress.
--- drivers/gpu/drm/i915/i915_guc_submission.c | 11 ++++++----- drivers/gpu/drm/i915/i915_irq.c | 6 ++++-- drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++-- drivers/gpu/drm/i915/intel_lrc.c | 21 +++++++++++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 5 files changed, 37 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -5
@@ -550,11 +550,9 @@ static void port_assign(struct execlist_port *port, struct drm_i915_gem_request *rq) {GEM_BUG_ON (rq ==port_request (port)); +GEM_BUG_ON (port_isset (port)); -if (port_isset (port)) -i915_gem_request_put (port_request (port)); - -port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); +port_set (port,i915_gem_request_get (rq));nested_enable_signaling (rq); }
@@ -586,8 +584,10 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) goto done; } -if (submit) +if (submit) {port_assign (port, last); + execlists->active++; + } port++; }
@@ -610,6 +610,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) execlists->first = rb;if (submit) {port_assign (port, last); + execlists->active++;i915_guc_submit (engine); }spin_unlock_irq (&engine->timeline->lock);
drivers/gpu/drm/i915/i915_irq.c +4 -2
@@ -1388,8 +1388,10 @@ gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir, int test_shift)bool tasklet = false;if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { -__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); - tasklet = true; +if (READ_ONCE (engine->execlists.active)) { +__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); + tasklet = true; + } }if (iir & (GT_RENDER_USER_INTERRUPT << test_shift)) {
drivers/gpu/drm/i915/intel_engine_cs.c +3 -2
@@ -1548,8 +1548,8 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)if (test_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted))return false; -/* Both ports drained, no more ELSP submission? */ -if (port_request (&engine->execlists.port[0 ])) +/* Waiting to drain ELSP? */ +if (READ_ONCE (engine->execlists.active))return false;/* ELSP is empty, but there are ready requests? */
@@ -1749,6 +1749,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m) idx); } } +drm_printf (m,"\t\tELSP active %d\n" , execlists->active);rcu_read_unlock (); }else if (INTEL_GEN (dev_priv) >6 ) { drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n",
drivers/gpu/drm/i915/intel_lrc.c +17 -4
@@ -482,15 +482,23 @@ static bool can_merge_ctx(const struct i915_gem_context *prev,return true; } -static void port_assign (struct execlist_port *port, +static bool port_assign (struct execlist_port *port,struct drm_i915_gem_request *rq) { +bool was_idle; +GEM_BUG_ON (rq ==port_request (port)); -if (port_isset (port)) +if (port_isset (port)) {i915_gem_request_put (port_request (port)); + was_idle = false; + }else { + was_idle = true; + }port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); + +return was_idle; }static void inject_preempt_context (struct intel_engine_cs *engine)
@@ -657,7 +665,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)GEM_BUG_ON (last->ctx == rq->ctx);if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); port++;GEM_BUG_ON (port_isset (port));
@@ -679,7 +687,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) done: execlists->first = rb;if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); unlock:spin_unlock_irq (&engine->timeline->lock);
@@ -696,10 +704,12 @@ execlist_cancel_port_requests(struct intel_engine_execlists *execlists)while (num_ports-- &&port_isset (port)) {struct drm_i915_gem_request *rq =port_request (port); +GEM_BUG_ON (!execlists->active);execlists_context_status_change (rq,INTEL_CONTEXT_SCHEDULE_PREEMPTED );i915_gem_request_put (rq);memset (port,0 ,sizeof (*port)); + execlists->active--; port++; } }
@@ -863,6 +873,8 @@ static void intel_lrc_irq_handler(unsigned long data)GEM_BUG_ON (!execlists->preempt); execlists->preempt = false; + execlists->active--; +GEM_BUG_ON (execlists->active);continue ; }
@@ -1461,6 +1473,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)clear_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); execlists->csb_head =-1 ; execlists->preempt = false; + execlists->active =0 ;/* After a GPU reset, we may have requests to replay */ if (!i915_modparams.enable_guc_submission && execlists->first)
drivers/gpu/drm/i915/intel_ringbuffer.h +7 -0
@@ -245,6 +245,11 @@ struct intel_engine_execlists {*/ bool preempt; +/** +* @active: count of the number of outstanding CSB events +*/ +unsigned int active; +/** * @port_mask: number of execlist ports - 1 */
@@ -538,9 +543,11 @@ execlists_port_complete(struct intel_engine_execlists * const execlists,const unsigned int m = execlists->port_mask;GEM_BUG_ON (port_index (port, execlists) !=0 ); +GEM_BUG_ON (!execlists->active);memmove (port, port +1 , m *sizeof (struct execlist_port ));memset (port + m,0 ,sizeof (struct execlist_port )); + execlists->active--; } static inline unsigned int
Signature · 6 lines
2.15.0.rc1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: Filter out spurious execlists context-switch interrupts
Back in commit a4b2b01523a8 ("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commit beecec901790 ("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a counter for the expected number of pending context-switches and skip if we do not need to handle this interrupt to make forward progress.
v2: Add the missing inc(active) for preempt.
--- drivers/gpu/drm/i915/i915_guc_submission.c | 11 ++++++----- drivers/gpu/drm/i915/i915_irq.c | 6 ++++-- drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++-- drivers/gpu/drm/i915/intel_lrc.c | 22 ++++++++++++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 5 files changed, 38 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +6 -5
@@ -550,11 +550,9 @@ static void port_assign(struct execlist_port *port, struct drm_i915_gem_request *rq) {GEM_BUG_ON (rq ==port_request (port)); +GEM_BUG_ON (port_isset (port)); -if (port_isset (port)) -i915_gem_request_put (port_request (port)); - -port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); +port_set (port,i915_gem_request_get (rq));nested_enable_signaling (rq); }
@@ -586,8 +584,10 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) goto done; } -if (submit) +if (submit) {port_assign (port, last); + execlists->active++; + } port++; }
@@ -610,6 +610,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) execlists->first = rb;if (submit) {port_assign (port, last); + execlists->active++;i915_guc_submit (engine); }spin_unlock_irq (&engine->timeline->lock);
drivers/gpu/drm/i915/i915_irq.c +4 -2
@@ -1388,8 +1388,10 @@ gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir, int test_shift)bool tasklet = false;if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { -__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); - tasklet = true; +if (READ_ONCE (engine->execlists.active)) { +__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); + tasklet = true; + } }if (iir & (GT_RENDER_USER_INTERRUPT << test_shift)) {
drivers/gpu/drm/i915/intel_engine_cs.c +3 -2
@@ -1548,8 +1548,8 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)if (test_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted))return false; -/* Both ports drained, no more ELSP submission? */ -if (port_request (&engine->execlists.port[0 ])) +/* Waiting to drain ELSP? */ +if (READ_ONCE (engine->execlists.active))return false;/* ELSP is empty, but there are ready requests? */
@@ -1749,6 +1749,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m) idx); } } +drm_printf (m,"\t\tELSP active %d\n" , execlists->active);rcu_read_unlock (); }else if (INTEL_GEN (dev_priv) >6 ) { drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n",
drivers/gpu/drm/i915/intel_lrc.c +18 -4
@@ -482,15 +482,23 @@ static bool can_merge_ctx(const struct i915_gem_context *prev,return true; } -static void port_assign (struct execlist_port *port, +static bool port_assign (struct execlist_port *port,struct drm_i915_gem_request *rq) { +bool was_idle; +GEM_BUG_ON (rq ==port_request (port)); -if (port_isset (port)) +if (port_isset (port)) {i915_gem_request_put (port_request (port)); + was_idle = false; + }else { + was_idle = true; + }port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); + +return was_idle; }static void inject_preempt_context (struct intel_engine_cs *engine)
@@ -576,6 +584,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)*/ inject_preempt_context (engine); execlists->preempt = true; + execlists->active++; goto unlock; }else {/*
@@ -657,7 +666,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)GEM_BUG_ON (last->ctx == rq->ctx);if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); port++;GEM_BUG_ON (port_isset (port));
@@ -679,7 +688,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) done: execlists->first = rb;if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); unlock:spin_unlock_irq (&engine->timeline->lock);
@@ -696,10 +705,12 @@ execlist_cancel_port_requests(struct intel_engine_execlists *execlists)while (num_ports-- &&port_isset (port)) {struct drm_i915_gem_request *rq =port_request (port); +GEM_BUG_ON (!execlists->active);execlists_context_status_change (rq,INTEL_CONTEXT_SCHEDULE_PREEMPTED );i915_gem_request_put (rq);memset (port,0 ,sizeof (*port)); + execlists->active--; port++; } }
@@ -863,6 +874,8 @@ static void intel_lrc_irq_handler(unsigned long data)GEM_BUG_ON (!execlists->preempt); execlists->preempt = false; + execlists->active--; +GEM_BUG_ON (execlists->active);continue ; }
@@ -1461,6 +1474,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)clear_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); execlists->csb_head =-1 ; execlists->preempt = false; + execlists->active =0 ;/* After a GPU reset, we may have requests to replay */ if (!i915_modparams.enable_guc_submission && execlists->first)
drivers/gpu/drm/i915/intel_ringbuffer.h +7 -0
@@ -245,6 +245,11 @@ struct intel_engine_execlists {*/ bool preempt; +/** +* @active: count of the number of outstanding CSB events +*/ +unsigned int active; +/** * @port_mask: number of execlist ports - 1 */
@@ -538,9 +543,11 @@ execlists_port_complete(struct intel_engine_execlists * const execlists,const unsigned int m = execlists->port_mask;GEM_BUG_ON (port_index (port, execlists) !=0 ); +GEM_BUG_ON (!execlists->active);memmove (port, port +1 , m *sizeof (struct execlist_port ));memset (port + m,0 ,sizeof (struct execlist_port )); + execlists->active--; } static inline unsigned int
Signature · 6 lines
2.15.0.rc1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Filter out spurious execlists context-switch interrupts
In reply to Chris WilsonQuoted 7 lines · Chris Wilson
Back in commit
a4b2b01523a8("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commitbeecec901790("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a
This confuses me, how can we preempt something that was never submitted. Could you elaborate?
Thanks,
-Mika
Quoted 209 lines
counter for the expected number of pending context-switches and skip if we do not need to handle this interrupt to make forward progress.
Fixes beecec901790 ("drm/i915/execlists: Preemption!")Signed-off-by Chris Wilson <[email protected]>Cc Michal Winiarski <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 11 ++++++----- drivers/gpu/drm/i915/i915_irq.c | 6 ++++-- drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++-- drivers/gpu/drm/i915/intel_lrc.c | 21 +++++++++++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 5 files changed, 37 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/i915_guc_submission.c +6
-5@@ -550,11 +550,9 @@ static void port_assign(struct execlist_port *port, struct drm_i915_gem_request *rq) {GEM_BUG_ON (rq ==port_request (port)); +GEM_BUG_ON (port_isset (port)); -if (port_isset (port)) -i915_gem_request_put (port_request (port)); - -port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); +port_set (port,i915_gem_request_get (rq));nested_enable_signaling (rq); }@@ -586,8 +584,10 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) goto done; } -if (submit) +if (submit) {port_assign (port, last); + execlists->active++; + } port++; }@@ -610,6 +610,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) execlists->first = rb;if (submit) {port_assign (port, last); + execlists->active++;i915_guc_submit (engine); }spin_unlock_irq (&engine->timeline->lock);drivers/gpu/drm/i915/i915_irq.c +4
-2@@ -1388,8 +1388,10 @@ gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir, int test_shift)bool tasklet = false;if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { -__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); - tasklet = true; +if (READ_ONCE (engine->execlists.active)) { +__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); + tasklet = true; + } }if (iir & (GT_RENDER_USER_INTERRUPT << test_shift)) {drivers/gpu/drm/i915/intel_engine_cs.c +3
-2@@ -1548,8 +1548,8 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)if (test_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted))return false; -/* Both ports drained, no more ELSP submission? */ -if (port_request (&engine->execlists.port[0 ])) +/* Waiting to drain ELSP? */ +if (READ_ONCE (engine->execlists.active))return false;/* ELSP is empty, but there are ready requests? */ @@ -1749,6 +1749,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m) idx); } } +drm_printf (m,"\t\tELSP active %d\n" , execlists->active);rcu_read_unlock (); }else if (INTEL_GEN (dev_priv) >6 ) { drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n",drivers/gpu/drm/i915/intel_lrc.c +17
-4@@ -482,15 +482,23 @@ static bool can_merge_ctx(const struct i915_gem_context *prev,return true; } -static void port_assign (struct execlist_port *port, +static bool port_assign (struct execlist_port *port,struct drm_i915_gem_request *rq) { +bool was_idle; +GEM_BUG_ON (rq ==port_request (port)); -if (port_isset (port)) +if (port_isset (port)) {i915_gem_request_put (port_request (port)); + was_idle = false; + }else { + was_idle = true; + }port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); + +return was_idle; }static void inject_preempt_context (struct intel_engine_cs *engine)@@ -657,7 +665,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)GEM_BUG_ON (last->ctx == rq->ctx);if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); port++;GEM_BUG_ON (port_isset (port));@@ -679,7 +687,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) done: execlists->first = rb;if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); unlock:spin_unlock_irq (&engine->timeline->lock);@@ -696,10 +704,12 @@ execlist_cancel_port_requests(struct intel_engine_execlists *execlists)while (num_ports-- &&port_isset (port)) {struct drm_i915_gem_request *rq =port_request (port); +GEM_BUG_ON (!execlists->active);execlists_context_status_change (rq,INTEL_CONTEXT_SCHEDULE_PREEMPTED );i915_gem_request_put (rq);memset (port,0 ,sizeof (*port)); + execlists->active--; port++; } }@@ -863,6 +873,8 @@ static void intel_lrc_irq_handler(unsigned long data)GEM_BUG_ON (!execlists->preempt); execlists->preempt = false; + execlists->active--; +GEM_BUG_ON (execlists->active);continue ; }@@ -1461,6 +1473,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)clear_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); execlists->csb_head =-1 ; execlists->preempt = false; + execlists->active =0 ;/* After a GPU reset, we may have requests to replay */ if (!i915_modparams.enable_guc_submission && execlists->first)drivers/gpu/drm/i915/intel_ringbuffer.h +7
-0@@ -245,6 +245,11 @@ struct intel_engine_execlists {*/ bool preempt; +/** +* @active: count of the number of outstanding CSB events +*/ +unsigned int active; +/** * @port_mask: number of execlist ports - 1 */ @@ -538,9 +543,11 @@ execlists_port_complete(struct intel_engine_execlists * const execlists,const unsigned int m = execlists->port_mask;GEM_BUG_ON (port_index (port, execlists) !=0 ); +GEM_BUG_ON (!execlists->active);memmove (port, port +1 , m *sizeof (struct execlist_port ));memset (port + m,0 ,sizeof (struct execlist_port )); + execlists->active--; } static inline unsigned intSignature · 6 lines
2.15.0.rc1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Filter out spurious execlists context-switch interrupts
Quoting Mika Kuoppala (2017-10-20 14:21:08)
Quoted 10 lines
Quoted 7 lines · Chris Wilson
Back in commit
a4b2b01523a8("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commitbeecec901790("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a
Quoted 2 lines
This confuses me, how can we preempt something that was never submitted. Could you elaborate?
The ELSP may become empty after we told the hw to switch to the preempt context. So the preemption context-switch may appear as a separate interrupt after !port_isset(execlists.port[0]). The joy of asynchronous communications.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Filter out spurious execlists context-switch interrupts
Quoted 11 lines · Chris Wilson
Quoting Mika Kuoppala (2017-10-20 14:21:08)
Quoted 10 lines
Quoted 7 lines · Chris Wilson
Back in commit
a4b2b01523a8("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commitbeecec901790("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a
Quoted 7 lines
Quoted 2 lines
This confuses me, how can we preempt something that was never submitted. Could you elaborate?
The ELSP may become empty after we told the hw to switch to the preempt context. So the preemption context-switch may appear as a separate interrupt after !port_isset(execlists.port[0]). The joy of asynchronous communications.
Let me check if I got this right: as we dont use port[0] to switch to preempt context and thus we might get 2 interrupts in a a row, first one clearing port[0], we can't assume any idleness by port[0] status alone?
-Mika
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Filter out spurious execlists context-switch interrupts
Quoting Mika Kuoppala (2017-10-20 14:31:14)
Quoted 21 lines
Quoted 11 lines · Chris Wilson
Quoting Mika Kuoppala (2017-10-20 14:21:08)
Quoted 10 lines
Quoted 7 lines · Chris Wilson
Back in commit
a4b2b01523a8("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commitbeecec901790("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add aQuoted 7 lines
Quoted 2 lines
This confuses me, how can we preempt something that was never submitted. Could you elaborate?
The ELSP may become empty after we told the hw to switch to the preempt context. So the preemption context-switch may appear as a separate interrupt after !port_isset(execlists.port[0]). The joy of asynchronous communications.
Quoted 4 lines
Let me check if I got this right: as we dont use port[0] to switch to preempt context and thus we might get 2 interrupts in a a row, first one clearing port[0], we can't assume any idleness by port[0] status alone?
Correct.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Filter out spurious execlists context-switch interrupts
In reply to Chris WilsonQuoted 30 lines · Chris Wilson
Back in commit
a4b2b01523a8("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commitbeecec901790("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a counter for the expected number of pending context-switches and skip if we do not need to handle this interrupt to make forward progress.Fixes beecec901790 ("drm/i915/execlists: Preemption!")Signed-off-by Chris Wilson <[email protected]>Cc Michal Winiarski <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 11 ++++++----- drivers/gpu/drm/i915/i915_irq.c | 6 ++++-- drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++-- drivers/gpu/drm/i915/intel_lrc.c | 21 +++++++++++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 5 files changed, 37 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/i915_guc_submission.c +0
-0
drivers/gpu/drm/i915/i915_guc_submission.c static void port_assign(struct execlist_port *port, · line 555
Quoted 10 lines
drivers/gpu/drm/i915/i915_guc_submission.c +2
-4@@ -550,11 +550,9 @@ static void port_assign(struct execlist_port *port, struct drm_i915_gem_request *rq) {GEM_BUG_ON (rq ==port_request (port)); +GEM_BUG_ON (port_isset (port)); -if (port_isset (port)) -i915_gem_request_put (port_request (port)); - -port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); +port_set (port,i915_gem_request_get (rq));
No lite restore with guc so we can make this more strict and lean?
Quoted 45 lines
drivers/gpu/drm/i915/i915_guc_submission.c +4
-1nested_enable_signaling (rq); }@@ -586,8 +584,10 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) goto done; } -if (submit) +if (submit) {port_assign (port, last); + execlists->active++; + } port++; }@@ -610,6 +610,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) execlists->first = rb;if (submit) {port_assign (port, last); + execlists->active++;i915_guc_submit (engine); }spin_unlock_irq (&engine->timeline->lock);drivers/gpu/drm/i915/i915_irq.c +4
-2@@ -1388,8 +1388,10 @@ gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir, int test_shift)bool tasklet = false;if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { -__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); - tasklet = true; +if (READ_ONCE (engine->execlists.active)) { +__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); + tasklet = true; + } }if (iir & (GT_RENDER_USER_INTERRUPT << test_shift)) {drivers/gpu/drm/i915/intel_engine_cs.c +0
-0
drivers/gpu/drm/i915/intel_engine_cs.c bool intel_engine_is_idle(struct intel_engine_cs *engine) · line 1554
Quoted 9 lines
drivers/gpu/drm/i915/intel_engine_cs.c +2
-2@@ -1548,8 +1548,8 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)if (test_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted))return false; -/* Both ports drained, no more ELSP submission? */ -if (port_request (&engine->execlists.port[0 ])) +/* Waiting to drain ELSP? */ +if (READ_ONCE (engine->execlists.active))return false;
It would not make sense now to keep the port[0] check but we could get more fine grained debugging info if we keep it?
-Mika
Quoted 122 lines
drivers/gpu/drm/i915/intel_engine_cs.c +1
-0/* ELSP is empty, but there are ready requests? */ @@ -1749,6 +1749,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m) idx); } } +drm_printf (m,"\t\tELSP active %d\n" , execlists->active);rcu_read_unlock (); }else if (INTEL_GEN (dev_priv) >6 ) { drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n",drivers/gpu/drm/i915/intel_lrc.c +17
-4@@ -482,15 +482,23 @@ static bool can_merge_ctx(const struct i915_gem_context *prev,return true; } -static void port_assign (struct execlist_port *port, +static bool port_assign (struct execlist_port *port,struct drm_i915_gem_request *rq) { +bool was_idle; +GEM_BUG_ON (rq ==port_request (port)); -if (port_isset (port)) +if (port_isset (port)) {i915_gem_request_put (port_request (port)); + was_idle = false; + }else { + was_idle = true; + }port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); + +return was_idle; }static void inject_preempt_context (struct intel_engine_cs *engine)@@ -657,7 +665,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)GEM_BUG_ON (last->ctx == rq->ctx);if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); port++;GEM_BUG_ON (port_isset (port));@@ -679,7 +687,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) done: execlists->first = rb;if (submit) -port_assign (port, last); + execlists->active +=port_assign (port, last); unlock:spin_unlock_irq (&engine->timeline->lock);@@ -696,10 +704,12 @@ execlist_cancel_port_requests(struct intel_engine_execlists *execlists)while (num_ports-- &&port_isset (port)) {struct drm_i915_gem_request *rq =port_request (port); +GEM_BUG_ON (!execlists->active);execlists_context_status_change (rq,INTEL_CONTEXT_SCHEDULE_PREEMPTED );i915_gem_request_put (rq);memset (port,0 ,sizeof (*port)); + execlists->active--; port++; } }@@ -863,6 +873,8 @@ static void intel_lrc_irq_handler(unsigned long data)GEM_BUG_ON (!execlists->preempt); execlists->preempt = false; + execlists->active--; +GEM_BUG_ON (execlists->active);continue ; }@@ -1461,6 +1473,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)clear_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); execlists->csb_head =-1 ; execlists->preempt = false; + execlists->active =0 ;/* After a GPU reset, we may have requests to replay */ if (!i915_modparams.enable_guc_submission && execlists->first)drivers/gpu/drm/i915/intel_ringbuffer.h +7
-0@@ -245,6 +245,11 @@ struct intel_engine_execlists {*/ bool preempt; +/** +* @active: count of the number of outstanding CSB events +*/ +unsigned int active; +/** * @port_mask: number of execlist ports - 1 */ @@ -538,9 +543,11 @@ execlists_port_complete(struct intel_engine_execlists * const execlists,const unsigned int m = execlists->port_mask;GEM_BUG_ON (port_index (port, execlists) !=0 ); +GEM_BUG_ON (!execlists->active);memmove (port, port +1 , m *sizeof (struct execlist_port ));memset (port + m,0 ,sizeof (struct execlist_port )); + execlists->active--; } static inline unsigned intSignature · 6 lines
2.15.0.rc1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Filter out spurious execlists context-switch interrupts
Quoting Mika Kuoppala (2017-10-20 14:59:44)
Quoted 37 lines
Quoted 35 lines · Chris Wilson
Back in commit
a4b2b01523a8("drm/i915: Don't mark an execlists context-switch when idle") we noticed the presence of late context-switch interrupts. We were able to filter those out by looking at whether the ELSP remained active, but in commitbeecec901790("drm/i915/execlists: Preemption!") that became problematic as we now anticipate receiving a context-switch event for preemption while ELSP may be empty. To restore the spurious interrupt suppression, add a counter for the expected number of pending context-switches and skip if we do not need to handle this interrupt to make forward progress.Fixes beecec901790 ("drm/i915/execlists: Preemption!")Signed-off-by Chris Wilson <[email protected]>Cc Michal Winiarski <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 11 ++++++----- drivers/gpu/drm/i915/i915_irq.c | 6 ++++-- drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++-- drivers/gpu/drm/i915/intel_lrc.c | 21 +++++++++++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 5 files changed, 37 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/i915_guc_submission.c +1
-0@@ -550,11 +550,9 @@ static void port_assign(struct execlist_port *port, struct drm_i915_gem_request *rq) {GEM_BUG_ON (rq ==port_request (port)); +GEM_BUG_ON (port_isset (port));
Quoted 7 lines
drivers/gpu/drm/i915/i915_guc_submission.c static void port_assign(struct execlist_port *port, · line 555
Quoted 5 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1
-4-if (port_isset (port)) -i915_gem_request_put (port_request (port)); - -port_set (port,port_pack (i915_gem_request_get (rq),port_count (port))); +port_set (port,i915_gem_request_get (rq));No lite restore with guc so we can make this more strict and lean?
Yes. We are not coalescing requests into an active slot, so we always know that we are assigning a new request into a new slot.
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0
-0@@ -1548,8 +1548,8 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)if (test_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted))return false;
Quoted 10 lines
drivers/gpu/drm/i915/intel_engine_cs.c bool intel_engine_is_idle(struct intel_engine_cs *engine) · line 1554
Quoted 6 lines
drivers/gpu/drm/i915/intel_engine_cs.c +2
-2-/* Both ports drained, no more ELSP submission? */ -if (port_request (&engine->execlists.port[0 ])) +/* Waiting to drain ELSP? */ +if (READ_ONCE (engine->execlists.active))return false;It would not make sense now to keep the port[0] check but we could get more fine grained debugging info if we keep it?
This function is the antithesis of fine grained debugging. It is called in a tight loop, watching for idle so reporting from here ends up with a lot of noise. Often I ask exactly what isn't idle... Now that we do a single upfront wait, and then a check all is well, moving this to intel_engine_park where we can be more verbose in the one-off state check is the next step.
The importance of making this change is so the gen8_cs_irq_handler() and the idle_worker are in sync about when to drop the GT wakeref. -Chris
_______________________________________________
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: Bump wait-times for the final CS interrupt before parking
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking
URL : https://patchwork.freedesktop.org/series/32349/
State : success
== Summary ==
Series 32349v1 series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking
https://patchwork.freedesktop.org/api/1.0/series/32349/revisions/1/mbox/
Test chamelium:
Subgroup dp-crc-fast:
pass -> FAIL (fi-kbl-7500u) fdo#102514
Test gem_exec_reloc:
Subgroup basic-cpu-gtt-active:
pass -> FAIL (fi-gdg-551) fdo#102582 +2
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (fi-byt-j1900) fdo#101705
Test drv_module_reload:
Subgroup basic-reload-inject:
dmesg-warn -> INCOMPLETE (fi-cfl-s) fdo#103206fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
fdo#103206 https://bugs.freedesktop.org/show_bug.cgi?id=103206
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:437s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:454s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:373s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:534s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:263s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:499s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:497s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:493s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:477s fi-cfl-s total:288 pass:253 dwarn:3 dfail:0 fail:0 skip:31 fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:406s fi-gdg-551 total:289 pass:174 dwarn:1 dfail:0 fail:5 skip:109 time:251s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:582s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:449s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:427s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:431s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:486s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:459s fi-kbl-7500u total:289 pass:263 dwarn:1 dfail:0 fail:1 skip:24 time:480s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:565s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:477s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:581s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:546s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:454s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:644s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:514s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:460s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:562s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:417s
8ddf486a3f3a9cdadfe9f86a879b5092c136e491 drm-tip: 2017y-10m-19d-20h-21m-08s UTC integration manifest 44db6733d92e drm/i915: Filter out spurious execlists context-switch interrupts c5717b809926 drm/i915: Bump wait-times for the final CS interrupt before parking
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6119/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking
URL : https://patchwork.freedesktop.org/series/32349/
State : success
== Summary ==
Test kms_busy:
Subgroup extended-modeset-hang-oldfb-with-reset-render-C:
pass -> DMESG-WARN (shard-hsw) fdo#102249
Test kms_flip:
Subgroup plain-flip-fb-recreate:
pass -> FAIL (shard-hsw) fdo#102504
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#102504 https://bugs.freedesktop.org/show_bug.cgi?id=102504
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-hsw total:2540 pass:1426 dwarn:3 dfail:0 fail:10 skip:1101 time:9198s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6119/shards.html
_______________________________________________
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: Bump wait-times for the final CS interrupt before parking (rev2)
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking (rev2)
URL : https://patchwork.freedesktop.org/series/32349/
State : success
== Summary ==
Series 32349v2 series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking
https://patchwork.freedesktop.org/api/1.0/series/32349/revisions/2/mbox/
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-b-frame-sequence:
incomplete -> PASS (fi-skl-6700hq) fdo#102035
Test prime_vgem:
Subgroup basic-fence-flip:
dmesg-warn -> PASS (fi-kbl-7567u) fdo#103165 +1fdo#102035 https://bugs.freedesktop.org/show_bug.cgi?id=102035
fdo#103165 https://bugs.freedesktop.org/show_bug.cgi?id=103165
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:456s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:447s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:370s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:544s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:264s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:503s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:500s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:504s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:485s fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:551s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:415s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:251s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:583s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:453s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:430s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:437s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:485s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:461s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:489s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:571s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:478s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:583s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:543s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:458s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:649s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:517s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:504s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:456s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:572s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:428s
75b85b0dce2faee585046d3ce19d76bcb163c3e7 drm-tip: 2017y-10m-20d-10h-07m-16s UTC integration manifest ba00357f8415 drm/i915: Filter out spurious execlists context-switch interrupts d38bebdd7c55 drm/i915: Bump wait-times for the final CS interrupt before parking
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6121/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 40 lines · Chris Wilson
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the
struct_mutexto avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.Signed-off-by Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_gem.c +3
-4@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); + do {
drivers/gpu/drm/i915/i915_gem.c i915_gem_idle_work_handler(struct work_struct *work) · line 3305
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +9
-0+if (READ_ONCE (dev_priv->gt.active_requests) || +work_pending (work)) +return ; + +if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end));
Why can't we just wait_for(intel_engines_are_idle(dev_priv, 200)) ?
-Mika
Quoted 39 lines
drivers/gpu/drm/i915/i915_gem.c +8
-7rearm_hangcheck =cancel_delayed_work_sync (&dev_priv->gpu_error.hangcheck_work); -if (!mutex_trylock (&dev->struct_mutex)) { +if (!mutex_trylock (&dev_priv->drm.struct_mutex)) {/* Currently busy, come back later */ mod_delayed_work(dev_priv->wq, &dev_priv->gt.idle_work,@@ -3310,13 +3318,14 @@ i915_gem_idle_work_handler(struct work_struct *work)* New request retired after this work handler started, extend active * period until next instance of the work. */ -if (work_pending (work)) +if (dev_priv->gt.active_requests ||work_pending (work)) goto out_unlock; -if (dev_priv->gt.active_requests) - goto out_unlock; - -if (wait_for (intel_engines_are_idle (dev_priv),10 )) +/* +* We are committed now to parking the engines, make sure there +* will be no more interrupts arriving later. +*/ +if (!intel_engines_are_idle (dev_priv))DRM_ERROR ("Timeout waiting for engines to idle\n" );intel_engines_mark_idle (dev_priv);@@ -3330,7 +3339,7 @@ i915_gem_idle_work_handler(struct work_struct *work)gen6_rps_idle (dev_priv);intel_runtime_pm_put (dev_priv); out_unlock: -mutex_unlock (&dev->struct_mutex); +mutex_unlock (&dev_priv->drm.struct_mutex); out_rearm:if (rearm_hangcheck) {Signature · 1 line
2.15.0.rc1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Mika Kuoppala (2017-10-20 14:11:53)
Quoted 46 lines
Quoted 44 lines · Chris Wilson
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the
struct_mutexto avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.Signed-off-by Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_gem.c +7
-4@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); + do { + if (READ_ONCE(dev_priv->gt.active_requests) || + work_pending(work)) + return; +
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_idle_work_handler(struct work_struct *work) · line 3305
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c +5
-0+if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end));Why can't we just
wait_for(intel_engines_are_idle(dev_priv, 200))?
That return. We don't really want to block the ordered wq for 200ms when we already know we won't make progress. (Whilst we are running nothing else that wants to use dev_priv->wq can.)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 56 lines · Chris Wilson
Quoting Mika Kuoppala (2017-10-20 14:11:53)
Quoted 46 lines
Quoted 44 lines · Chris Wilson
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the
struct_mutexto avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.Signed-off-by Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_gem.c +7
-4@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); + do { + if (READ_ONCE(dev_priv->gt.active_requests) || + work_pending(work)) + return; +Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c i915_gem_idle_work_handler(struct work_struct *work) · line 3305
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c +5
-0+if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end));Why can't we just
wait_for(intel_engines_are_idle(dev_priv, 200))?
Quoted 3 lines
That return. We don't really want to block the ordered wq for 200ms when we already know we won't make progress. (Whilst we are running nothing else that wants to use
dev_priv->wqcan.)
Ok, that makes sense but why don't we have own workqueue for the idleworker?
-Mika
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Mika Kuoppala (2017-10-20 14:23:02)
Quoted 58 lines
Quoted 56 lines · Chris Wilson
Quoting Mika Kuoppala (2017-10-20 14:11:53)
Quoted 54 lines
Quoted 40 lines · Chris Wilson
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the
struct_mutexto avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.Signed-off-by Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_gem.c +3
-4@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); + do {drivers/gpu/drm/i915/i915_gem.c i915_gem_idle_work_handler(struct work_struct *work) · line 3305
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +9
-0+if (READ_ONCE (dev_priv->gt.active_requests) || +work_pending (work)) +return ; + +if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end));Why can't we just
wait_for(intel_engines_are_idle(dev_priv, 200))?
Quoted 6 lines
Quoted 3 lines
That return. We don't really want to block the ordered wq for 200ms when we already know we won't make progress. (Whilst we are running nothing else that wants to use
dev_priv->wqcan.)Ok, that makes sense but why don't we have own workqueue for the idleworker?
We have a wq for those lowfreq work that need struct_mutex. We don't really need it, it just helps to have a named wq when staring at a stuck machine. One wq per struct work_struct would seem to be overkill ;) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking (rev2)
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Bump wait-times for the final CS interrupt before parking (rev2)
URL : https://patchwork.freedesktop.org/series/32349/
State : success
== Summary ==
Test kms_plane:
Subgroup plane-position-hole-pipe-A-planes:
skip -> PASS (shard-hsw)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-cur-indfb-move:
skip -> PASS (shard-hsw)
Subgroup fbc-1p-offscren-pri-indfb-draw-mmap-cpu:
skip -> PASS (shard-hsw)
Test kms_busy:
Subgroup extended-modeset-hang-newfb-with-reset-render-B:
dmesg-warn -> PASS (shard-hsw) fdo#103038
Subgroup extended-modeset-hang-oldfb-with-reset-render-B:
dmesg-warn -> PASS (shard-hsw) fdo#102249
Test kms_flip:
Subgroup blt-wf_vblank-vs-dpms:
dmesg-warn -> PASS (shard-hsw)
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912fdo#103038 https://bugs.freedesktop.org/show_bug.cgi?id=103038
fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-hsw total:2540 pass:1429 dwarn:1 dfail:0 fail:9 skip:1101 time:9212s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6121/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 59 lines · Chris Wilson
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the
struct_mutexto avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.Signed-off-by Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_gem.c +13
-5@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); +do { +if (READ_ONCE (dev_priv->gt.active_requests) || +work_pending (work)) +return ; + +if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end)); rearm_hangcheck =cancel_delayed_work_sync (&dev_priv->gpu_error.hangcheck_work); -if (!mutex_trylock (&dev->struct_mutex)) { +if (!mutex_trylock (&dev_priv->drm.struct_mutex)) {/* Currently busy, come back later */ mod_delayed_work(dev_priv->wq, &dev_priv->gt.idle_work,
drivers/gpu/drm/i915/i915_gem.c i915_gem_idle_work_handler(struct work_struct *work) · line 3323
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c +1
-1@@ -3310,13 +3318,14 @@ i915_gem_idle_work_handler(struct work_struct *work)* New request retired after this work handler started, extend active * period until next instance of the work. */ -if (work_pending (work)) +if (dev_priv->gt.active_requests ||work_pending (work)) goto out_unlock;
In here there might be some value of introducing helper
for gt_work_pending as you could use it in early bailout and in here. You would get one superfluous READ_ONCE by having that inside the helper but in idle work it doesnt matter.
I think it would read better too. But as it is in bikesched department.
Quoted 23 lines
drivers/gpu/drm/i915/i915_gem.c +6
-5-if (dev_priv->gt.active_requests) - goto out_unlock; - -if (wait_for (intel_engines_are_idle (dev_priv),10 )) +/* +* We are committed now to parking the engines, make sure there +* will be no more interrupts arriving later. +*/ +if (!intel_engines_are_idle (dev_priv))DRM_ERROR ("Timeout waiting for engines to idle\n" );intel_engines_mark_idle (dev_priv);@@ -3330,7 +3339,7 @@ i915_gem_idle_work_handler(struct work_struct *work)gen6_rps_idle (dev_priv);intel_runtime_pm_put (dev_priv); out_unlock: -mutex_unlock (&dev->struct_mutex); +mutex_unlock (&dev_priv->drm.struct_mutex); out_rearm:if (rearm_hangcheck) {Signature · 1 line
2.15.0.rc1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Mika Kuoppala (2017-10-23 12:52:11)
Quoted 74 lines
Quoted 59 lines · Chris Wilson
In the idle worker we drop the prolonged GT wakeref used to cover such essentials as interrupt delivery. (When a CS interrupt arrives, we also assert that the GT is awake.) However, it turns out that 10ms is not long enough to be assured that the last CS interrupt has been delivered, so bump that to 200ms, and move the entirety of that wait to before we take the
struct_mutexto avoid blocking. As this is now a potentially long wait, restore the earlier behaviour of bailing out early when a new request arrives.Signed-off-by Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_gem.c +13
-5@@ -3281,8 +3281,8 @@ i915_gem_idle_work_handler(struct work_struct *work) {struct drm_i915_private *dev_priv =container_of (work,typeof (*dev_priv), gt.idle_work.work); -struct drm_device *dev = &dev_priv->drm;bool rearm_hangcheck; +ktime_t end;if (!READ_ONCE (dev_priv->gt.awake))return ;@@ -3291,14 +3291,22 @@ i915_gem_idle_work_handler(struct work_struct *work)* Wait for last execlists context complete, but bail out in case a * new request is submitted. */ -wait_for (intel_engines_are_idle (dev_priv),10 ); -if (READ_ONCE (dev_priv->gt.active_requests)) -return ; + end =ktime_add_ms (ktime_get (),200 ); +do { +if (READ_ONCE (dev_priv->gt.active_requests) || +work_pending (work)) +return ; + +if (intel_engines_are_idle (dev_priv)) +break ; + +usleep_range (100 ,500 ); + }while (ktime_before (ktime_get (), end)); rearm_hangcheck =cancel_delayed_work_sync (&dev_priv->gpu_error.hangcheck_work); -if (!mutex_trylock (&dev->struct_mutex)) { +if (!mutex_trylock (&dev_priv->drm.struct_mutex)) {/* Currently busy, come back later */ mod_delayed_work(dev_priv->wq, &dev_priv->gt.idle_work,drivers/gpu/drm/i915/i915_gem.c i915_gem_idle_work_handler(struct work_struct *work) · line 3323
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c +1
-1@@ -3310,13 +3318,14 @@ i915_gem_idle_work_handler(struct work_struct *work)* New request retired after this work handler started, extend active * period until next instance of the work. */ -if (work_pending (work)) +if (dev_priv->gt.active_requests ||work_pending (work)) goto out_unlock;In here there might be some value of introducing helper
forgt_work_pendingas you could use it in early bailout and in here. You would get one superfluousREAD_ONCEby having that inside the helper but in idle work it doesnt matter.
Quoted 2 lines
I think it would read better too. But as it is in bikesched department.
Read better depends on finding the right name.
new_requests_since_last_retire()?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx