All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Speed up idle detection by kicking the tasklets
@ 2018-05-06 15:15 Chris Wilson
  2018-05-06 15:55 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Chris Wilson @ 2018-05-06 15:15 UTC (permalink / raw)
  To: intel-gfx

We rely on ksoftirqd to run in a timely fashion in order to drain the
execlists queue. Quite frequently, it does not. In some cases we may see
latencies of over 200ms triggering our idle timeouts and forcing us to
declare the driver wedged!

Thus we can speed up idle detection by bypassing ksoftirqd in these
cases and flush our tasklet to confirm if we are indeed still waiting
for the ELSP to drain.

References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 70325e0824e3..acf87dc73bf4 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -945,12 +945,17 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
 		return true;
 
 	/* Waiting to drain ELSP? */
-	if (READ_ONCE(engine->execlists.active))
-		return false;
+	if (READ_ONCE(engine->execlists.active)) {
+		struct intel_engine_execlists *execlists = &engine->execlists;
 
-	/* ELSP is empty, but there are ready requests? */
-	if (READ_ONCE(engine->execlists.first))
-		return false;
+		if (tasklet_trylock(&execlists->tasklet)) {
+			execlists->tasklet.func(execlists->tasklet.data);
+			tasklet_unlock(&execlists->tasklet);
+		}
+
+		if (READ_ONCE(execlists->active))
+			return false;
+	}
 
 	/* Ring stopped? */
 	if (!ring_is_idle(engine))
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
@ 2018-05-06 15:55 ` Patchwork
  2018-05-06 16:41 ` ✗ Fi.CI.IGT: failure " Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-05-06 15:55 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Speed up idle detection by kicking the tasklets
URL   : https://patchwork.freedesktop.org/series/42774/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4149 -> Patchwork_8916 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42774/revisions/1/mbox/

== Known issues ==

  Here are the changes found in Patchwork_8916 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-cnl-y3:          PASS -> DMESG-WARN (fdo#104951)

    
    ==== Possible fixes ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@gem_exec_suspend@basic-s4-devices:
      fi-skl-guc:         FAIL (fdo#104699, fdo#105900) -> PASS +1

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-cnl-psr:         FAIL (fdo#100368) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      {fi-hsw-peppy}:     DMESG-FAIL (fdo#102614, fdo#106103) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-ivb-3520m:       DMESG-WARN (fdo#106084) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#104699 https://bugs.freedesktop.org/show_bug.cgi?id=104699
  fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
  fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
  fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084
  fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103


== Participating hosts (40 -> 36) ==

  Missing    (4): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq fi-pnv-d510 


== Build changes ==

    * Linux: CI_DRM_4149 -> Patchwork_8916

  CI_DRM_4149: 6c2ec0dee7d19b798a1de1101175f5a076549cd9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4461: f772d9a910130b3aec8efa4f09ed723618fae656 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8916: 14a4ce18c1a19e75a3bbd0f462df88d6ff1df21f @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4461: 55207ea5154dfaa6d2c128124c50e3be4f9b6440 @ git://anongit.freedesktop.org/piglit


== Linux commits ==

14a4ce18c1a1 drm/i915: Speed up idle detection by kicking the tasklets

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8916/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* ✗ Fi.CI.IGT: failure for drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
  2018-05-06 15:55 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-05-06 16:41 ` Patchwork
  2018-05-06 17:13 ` [PATCH v2] " Chris Wilson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-05-06 16:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Speed up idle detection by kicking the tasklets
URL   : https://patchwork.freedesktop.org/series/42774/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4149_full -> Patchwork_8916_full =

== Summary - FAILURE ==

  Serious unknown changes coming with Patchwork_8916_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_8916_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42774/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_8916_full:

  === IGT changes ===

    ==== Possible regressions ====

    igt@drv_selftest@live_hangcheck:
      shard-kbl:          PASS -> DMESG-FAIL
      shard-apl:          PASS -> DMESG-FAIL
      shard-glk:          PASS -> DMESG-FAIL

    
    ==== Warnings ====

    igt@drv_selftest@live_execlists:
      shard-glk:          PASS -> SKIP +1
      shard-apl:          PASS -> SKIP +1

    igt@gem_mocs_settings@mocs-rc6-bsd1:
      shard-kbl:          SKIP -> PASS

    igt@gem_mocs_settings@mocs-rc6-vebox:
      shard-kbl:          PASS -> SKIP +3

    
== Known issues ==

  Here are the changes found in Patchwork_8916_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-hsw:          PASS -> FAIL (fdo#102887)

    igt@kms_flip@basic-flip-vs-modeset:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103558, fdo#105345)

    igt@kms_flip@flip-vs-absolute-wf_vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_vblank@pipe-c-ts-continuation-suspend:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          INCOMPLETE (fdo#106023, fdo#103665) -> PASS

    igt@kms_flip@absolute-wf_vblank-interruptible:
      shard-glk:          FAIL (fdo#106087) -> PASS

    igt@prime_vgem@basic-fence-flip:
      shard-kbl:          DMESG-WARN (fdo#106247) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
  fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#105345 https://bugs.freedesktop.org/show_bug.cgi?id=105345
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106087 https://bugs.freedesktop.org/show_bug.cgi?id=106087
  fdo#106247 https://bugs.freedesktop.org/show_bug.cgi?id=106247


== Participating hosts (6 -> 6) ==

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4149 -> Patchwork_8916

  CI_DRM_4149: 6c2ec0dee7d19b798a1de1101175f5a076549cd9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4461: f772d9a910130b3aec8efa4f09ed723618fae656 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8916: 14a4ce18c1a19e75a3bbd0f462df88d6ff1df21f @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4461: 55207ea5154dfaa6d2c128124c50e3be4f9b6440 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8916/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
  2018-05-06 15:55 ` ✓ Fi.CI.BAT: success for " Patchwork
  2018-05-06 16:41 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-05-06 17:13 ` Chris Wilson
  2018-05-07  8:34   ` Mika Kuoppala
  2018-05-06 17:33 ` ✓ Fi.CI.BAT: success for drm/i915: Speed up idle detection by kicking the tasklets (rev2) Patchwork
  2018-05-06 18:17 ` ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 1 reply; 10+ messages in thread
From: Chris Wilson @ 2018-05-06 17:13 UTC (permalink / raw)
  To: intel-gfx

We rely on ksoftirqd to run in a timely fashion in order to drain the
execlists queue. Quite frequently, it does not. In some cases we may see
latencies of over 200ms triggering our idle timeouts and forcing us to
declare the driver wedged!

Thus we can speed up idle detection by bypassing ksoftirqd in these
cases and flush our tasklet to confirm if we are indeed still waiting
for the ELSP to drain.

v2: Put the execlists.first check back; it is required for handling
reset!

References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 70325e0824e3..a3111511ea1d 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -945,10 +945,19 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
 		return true;
 
 	/* Waiting to drain ELSP? */
-	if (READ_ONCE(engine->execlists.active))
-		return false;
+	if (READ_ONCE(engine->execlists.active)) {
+		struct intel_engine_execlists *execlists = &engine->execlists;
+
+		if (tasklet_trylock(&execlists->tasklet)) {
+			execlists->tasklet.func(execlists->tasklet.data);
+			tasklet_unlock(&execlists->tasklet);
+		}
+
+		if (READ_ONCE(execlists->active))
+			return false;
+	}
 
-	/* ELSP is empty, but there are ready requests? */
+	/* ELSP is empty, but there are ready requests? E.g. after reset */
 	if (READ_ONCE(engine->execlists.first))
 		return false;
 
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Speed up idle detection by kicking the tasklets (rev2)
  2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
                   ` (2 preceding siblings ...)
  2018-05-06 17:13 ` [PATCH v2] " Chris Wilson
@ 2018-05-06 17:33 ` Patchwork
  2018-05-06 18:17 ` ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-05-06 17:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Speed up idle detection by kicking the tasklets (rev2)
URL   : https://patchwork.freedesktop.org/series/42774/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4149 -> Patchwork_8917 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42774/revisions/2/mbox/

== Known issues ==

  Here are the changes found in Patchwork_8917 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       PASS -> DMESG-WARN (fdo#105128)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    
    ==== Possible fixes ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@gem_exec_suspend@basic-s4-devices:
      fi-skl-guc:         FAIL (fdo#104699, fdo#105900) -> PASS

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-cnl-psr:         FAIL (fdo#100368) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      {fi-hsw-peppy}:     DMESG-FAIL (fdo#106103, fdo#102614) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-ivb-3520m:       DMESG-WARN (fdo#106084) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104699 https://bugs.freedesktop.org/show_bug.cgi?id=104699
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
  fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084
  fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103


== Participating hosts (40 -> 36) ==

  Missing    (4): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq fi-pnv-d510 


== Build changes ==

    * Linux: CI_DRM_4149 -> Patchwork_8917

  CI_DRM_4149: 6c2ec0dee7d19b798a1de1101175f5a076549cd9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4461: f772d9a910130b3aec8efa4f09ed723618fae656 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8917: 3b17807f11cec4848f77705fd31c23c15dbac3f1 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4461: 55207ea5154dfaa6d2c128124c50e3be4f9b6440 @ git://anongit.freedesktop.org/piglit


== Linux commits ==

3b17807f11ce drm/i915: Speed up idle detection by kicking the tasklets

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8917/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Speed up idle detection by kicking the tasklets (rev2)
  2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
                   ` (3 preceding siblings ...)
  2018-05-06 17:33 ` ✓ Fi.CI.BAT: success for drm/i915: Speed up idle detection by kicking the tasklets (rev2) Patchwork
@ 2018-05-06 18:17 ` Patchwork
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-05-06 18:17 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Speed up idle detection by kicking the tasklets (rev2)
URL   : https://patchwork.freedesktop.org/series/42774/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4149_full -> Patchwork_8917_full =

== Summary - WARNING ==

  Minor unknown changes coming with Patchwork_8917_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_8917_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42774/revisions/2/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_8917_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_mocs_settings@mocs-rc6-bsd1:
      shard-kbl:          SKIP -> PASS

    igt@gem_mocs_settings@mocs-rc6-ctx-render:
      shard-kbl:          PASS -> SKIP

    
== Known issues ==

  Here are the changes found in Patchwork_8917_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@kms_flip@2x-plain-flip-fb-recreate:
      shard-hsw:          PASS -> FAIL (fdo#100368)

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-hsw:          PASS -> FAIL (fdo#105707)

    igt@kms_rotation_crc@sprite-rotation-90-pos-100-0:
      shard-apl:          PASS -> FAIL (fdo#103925)

    igt@kms_vblank@pipe-c-ts-continuation-suspend:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          INCOMPLETE (fdo#106023, fdo#103665) -> PASS

    igt@kms_flip@absolute-wf_vblank-interruptible:
      shard-glk:          FAIL (fdo#106087) -> PASS

    igt@kms_setmode@basic:
      shard-glk:          FAIL (fdo#99912) -> PASS
      shard-kbl:          FAIL (fdo#99912) -> PASS

    igt@prime_vgem@basic-fence-flip:
      shard-kbl:          DMESG-WARN (fdo#106247) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#105707 https://bugs.freedesktop.org/show_bug.cgi?id=105707
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106087 https://bugs.freedesktop.org/show_bug.cgi?id=106087
  fdo#106247 https://bugs.freedesktop.org/show_bug.cgi?id=106247
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (6 -> 6) ==

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4149 -> Patchwork_8917

  CI_DRM_4149: 6c2ec0dee7d19b798a1de1101175f5a076549cd9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4461: f772d9a910130b3aec8efa4f09ed723618fae656 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8917: 3b17807f11cec4848f77705fd31c23c15dbac3f1 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4461: 55207ea5154dfaa6d2c128124c50e3be4f9b6440 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8917/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-06 17:13 ` [PATCH v2] " Chris Wilson
@ 2018-05-07  8:34   ` Mika Kuoppala
  2018-05-07  8:38     ` Chris Wilson
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Kuoppala @ 2018-05-07  8:34 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

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

> We rely on ksoftirqd to run in a timely fashion in order to drain the
> execlists queue. Quite frequently, it does not. In some cases we may see
> latencies of over 200ms triggering our idle timeouts and forcing us to
> declare the driver wedged!
>
> Thus we can speed up idle detection by bypassing ksoftirqd in these
> cases and flush our tasklet to confirm if we are indeed still waiting
> for the ELSP to drain.
>
> v2: Put the execlists.first check back; it is required for handling
> reset!
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 70325e0824e3..a3111511ea1d 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -945,10 +945,19 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
>  		return true;
>  
>  	/* Waiting to drain ELSP? */
> -	if (READ_ONCE(engine->execlists.active))
> -		return false;
> +	if (READ_ONCE(engine->execlists.active)) {
> +		struct intel_engine_execlists *execlists = &engine->execlists;
> +
> +		if (tasklet_trylock(&execlists->tasklet)) {

Now that we have the lock, sample active again to catch
the late tasklet run and skip running if so?

-Mika

> +			execlists->tasklet.func(execlists->tasklet.data);
> +			tasklet_unlock(&execlists->tasklet);
> +		}
> +
> +		if (READ_ONCE(execlists->active))
> +			return false;
> +	}
>  
> -	/* ELSP is empty, but there are ready requests? */
> +	/* ELSP is empty, but there are ready requests? E.g. after reset */
>  	if (READ_ONCE(engine->execlists.first))
>  		return false;
>  
> -- 
> 2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-07  8:34   ` Mika Kuoppala
@ 2018-05-07  8:38     ` Chris Wilson
  2018-05-07  8:54       ` Mika Kuoppala
  0 siblings, 1 reply; 10+ messages in thread
From: Chris Wilson @ 2018-05-07  8:38 UTC (permalink / raw)
  To: Mika Kuoppala, intel-gfx

Quoting Mika Kuoppala (2018-05-07 09:34:24)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > We rely on ksoftirqd to run in a timely fashion in order to drain the
> > execlists queue. Quite frequently, it does not. In some cases we may see
> > latencies of over 200ms triggering our idle timeouts and forcing us to
> > declare the driver wedged!
> >
> > Thus we can speed up idle detection by bypassing ksoftirqd in these
> > cases and flush our tasklet to confirm if we are indeed still waiting
> > for the ELSP to drain.
> >
> > v2: Put the execlists.first check back; it is required for handling
> > reset!
> >
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++++---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> > index 70325e0824e3..a3111511ea1d 100644
> > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> > @@ -945,10 +945,19 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
> >               return true;
> >  
> >       /* Waiting to drain ELSP? */
> > -     if (READ_ONCE(engine->execlists.active))
> > -             return false;
> > +     if (READ_ONCE(engine->execlists.active)) {
> > +             struct intel_engine_execlists *execlists = &engine->execlists;
> > +
> > +             if (tasklet_trylock(&execlists->tasklet)) {
> 
> Now that we have the lock, sample active again to catch
> the late tasklet run and skip running if so?

It becomes a nop in the submission tasklet, it's not dangerous. So it
comes down to what looks less of a wart!
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-07  8:38     ` Chris Wilson
@ 2018-05-07  8:54       ` Mika Kuoppala
  2018-05-07  9:03         ` Chris Wilson
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Kuoppala @ 2018-05-07  8:54 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

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

> Quoting Mika Kuoppala (2018-05-07 09:34:24)
>> Chris Wilson <chris@chris-wilson.co.uk> writes:
>> 
>> > We rely on ksoftirqd to run in a timely fashion in order to drain the
>> > execlists queue. Quite frequently, it does not. In some cases we may see
>> > latencies of over 200ms triggering our idle timeouts and forcing us to
>> > declare the driver wedged!
>> >
>> > Thus we can speed up idle detection by bypassing ksoftirqd in these
>> > cases and flush our tasklet to confirm if we are indeed still waiting
>> > for the ELSP to drain.
>> >
>> > v2: Put the execlists.first check back; it is required for handling
>> > reset!
>> >
>> > References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
>> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++++---
>> >  1 file changed, 12 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
>> > index 70325e0824e3..a3111511ea1d 100644
>> > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
>> > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
>> > @@ -945,10 +945,19 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
>> >               return true;
>> >  
>> >       /* Waiting to drain ELSP? */
>> > -     if (READ_ONCE(engine->execlists.active))
>> > -             return false;
>> > +     if (READ_ONCE(engine->execlists.active)) {
>> > +             struct intel_engine_execlists *execlists = &engine->execlists;
>> > +
>> > +             if (tasklet_trylock(&execlists->tasklet)) {
>> 
>> Now that we have the lock, sample active again to catch
>> the late tasklet run and skip running if so?
>
> It becomes a nop in the submission tasklet, it's not dangerous. So it
> comes down to what looks less of a wart!

The nice side effect of this kick is that now the hangcheck also won't
fall a victim.

Should we have a test which adds random and long tasklet delays?

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] drm/i915: Speed up idle detection by kicking the tasklets
  2018-05-07  8:54       ` Mika Kuoppala
@ 2018-05-07  9:03         ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-05-07  9:03 UTC (permalink / raw)
  To: Mika Kuoppala, intel-gfx

Quoting Mika Kuoppala (2018-05-07 09:54:27)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > Quoting Mika Kuoppala (2018-05-07 09:34:24)
> >> Chris Wilson <chris@chris-wilson.co.uk> writes:
> >> 
> >> > We rely on ksoftirqd to run in a timely fashion in order to drain the
> >> > execlists queue. Quite frequently, it does not. In some cases we may see
> >> > latencies of over 200ms triggering our idle timeouts and forcing us to
> >> > declare the driver wedged!
> >> >
> >> > Thus we can speed up idle detection by bypassing ksoftirqd in these
> >> > cases and flush our tasklet to confirm if we are indeed still waiting
> >> > for the ELSP to drain.
> >> >
> >> > v2: Put the execlists.first check back; it is required for handling
> >> > reset!
> >> >
> >> > References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
> >> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> >> > ---
> >> >  drivers/gpu/drm/i915/intel_engine_cs.c | 15 ++++++++++++---
> >> >  1 file changed, 12 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> >> > index 70325e0824e3..a3111511ea1d 100644
> >> > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> >> > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> >> > @@ -945,10 +945,19 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
> >> >               return true;
> >> >  
> >> >       /* Waiting to drain ELSP? */
> >> > -     if (READ_ONCE(engine->execlists.active))
> >> > -             return false;
> >> > +     if (READ_ONCE(engine->execlists.active)) {
> >> > +             struct intel_engine_execlists *execlists = &engine->execlists;
> >> > +
> >> > +             if (tasklet_trylock(&execlists->tasklet)) {
> >> 
> >> Now that we have the lock, sample active again to catch
> >> the late tasklet run and skip running if so?
> >
> > It becomes a nop in the submission tasklet, it's not dangerous. So it
> > comes down to what looks less of a wart!
> 
> The nice side effect of this kick is that now the hangcheck also won't
> fall a victim.
> 
> Should we have a test which adds random and long tasklet delays?

We do, it's called userspace :)

We stumbled across a good way of using a RT hog to delay ksoftirqd
arbitrarily; it just has the requirement of forcing the tasklet onto the
ksoftirqd for the same cpu...
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-05-07  9:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-06 15:15 [PATCH] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
2018-05-06 15:55 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-05-06 16:41 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-05-06 17:13 ` [PATCH v2] " Chris Wilson
2018-05-07  8:34   ` Mika Kuoppala
2018-05-07  8:38     ` Chris Wilson
2018-05-07  8:54       ` Mika Kuoppala
2018-05-07  9:03         ` Chris Wilson
2018-05-06 17:33 ` ✓ Fi.CI.BAT: success for drm/i915: Speed up idle detection by kicking the tasklets (rev2) Patchwork
2018-05-06 18:17 ` ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.