All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/shrinker: Wrap need_resched() inside preempt-disable
@ 2017-08-04 10:41 Chris Wilson
  2017-08-04 11:17 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2017-08-04 11:52 ` [PATCH] " Joonas Lahtinen
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2017-08-04 10:41 UTC (permalink / raw)
  To: intel-gfx; +Cc: drm-intel-fixes

In order for us to successfully detect the end of a timeslice,
preemption must be disabled. Otherwise, inside the loop we may be
preempted many times without our noticing, and each time our timeslice
will be reset, invalidating need_resched()

Reported-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reported-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
Fixes: 290271de34f6 ("drm/i915: Spin for struct_mutex inside shrinker")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.13-rc1+
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 26697c9e317d..3a34dcf00174 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -43,16 +43,21 @@ static bool shrinker_lock(struct drm_i915_private *dev_priv, bool *unlock)
 		return true;
 
 	case MUTEX_TRYLOCK_FAILED:
+		*unlock = false;
+		preempt_disable();
 		do {
 			cpu_relax();
 			if (mutex_trylock(&dev_priv->drm.struct_mutex)) {
-	case MUTEX_TRYLOCK_SUCCESS:
 				*unlock = true;
-				return true;
+				break;
 			}
 		} while (!need_resched());
+		preempt_enable();
+		return *unlock;
 
-		return false;
+	case MUTEX_TRYLOCK_SUCCESS:
+		*unlock = true;
+		return true;
 	}
 
 	BUG();
-- 
2.13.3

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

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

* ✗ Fi.CI.BAT: failure for drm/i915/shrinker: Wrap need_resched() inside preempt-disable
  2017-08-04 10:41 [PATCH] drm/i915/shrinker: Wrap need_resched() inside preempt-disable Chris Wilson
@ 2017-08-04 11:17 ` Patchwork
  2017-08-04 11:52 ` [PATCH] " Joonas Lahtinen
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2017-08-04 11:17 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/shrinker: Wrap need_resched() inside preempt-disable
URL   : https://patchwork.freedesktop.org/series/28371/
State : failure

== Summary ==

Series 28371v1 drm/i915/shrinker: Wrap need_resched() inside preempt-disable
https://patchwork.freedesktop.org/api/1.0/series/28371/revisions/1/mbox/

Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> INCOMPLETE (fi-skl-6260u)
Test gem_sync:
        Subgroup basic-store-all:
                fail       -> PASS       (fi-ivb-3520m) fdo#100007
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                pass       -> FAIL       (fi-snb-2600) fdo#100215
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                skip       -> PASS       (fi-skl-x1585l) fdo#101781
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-pnv-d510) fdo#101597
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-j1900) fdo#101705 +1

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
fdo#101597 https://bugs.freedesktop.org/show_bug.cgi?id=101597
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:438s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:421s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:360s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:491s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:491s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:516s
fi-byt-n2820     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:513s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:584s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:439s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:419s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:499s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:453s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:567s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:574s
fi-pnv-d510      total:279  pass:221  dwarn:3   dfail:0   fail:0   skip:55  time:571s
fi-skl-6260u     total:109  pass:105  dwarn:0   dfail:0   fail:0   skip:3  
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:638s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:469s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:429s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:488s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:548s
fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:406s

0394eb2d550a7b53adb3e36d0b79904ab8f1ffb2 drm-tip: 2017y-08m-04d-09h-39m-16s UTC integration manifest
aa253b5ccdf1 drm/i915/shrinker: Wrap need_resched() inside preempt-disable

== Logs ==

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

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

* Re: [PATCH] drm/i915/shrinker: Wrap need_resched() inside preempt-disable
  2017-08-04 10:41 [PATCH] drm/i915/shrinker: Wrap need_resched() inside preempt-disable Chris Wilson
  2017-08-04 11:17 ` ✗ Fi.CI.BAT: failure for " Patchwork
@ 2017-08-04 11:52 ` Joonas Lahtinen
  2017-08-04 12:15   ` Chris Wilson
  1 sibling, 1 reply; 4+ messages in thread
From: Joonas Lahtinen @ 2017-08-04 11:52 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: drm-intel-fixes

On pe, 2017-08-04 at 11:41 +0100, Chris Wilson wrote:
> In order for us to successfully detect the end of a timeslice,
> preemption must be disabled. Otherwise, inside the loop we may be
> preempted many times without our noticing, and each time our timeslice
> will be reset, invalidating need_resched()
> 
> Reported-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reported-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
> Fixes: 290271de34f6 ("drm/i915: Spin for struct_mutex inside shrinker")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.13-rc1+

Gets rid of the hang for my BDW.

Tested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/shrinker: Wrap need_resched() inside preempt-disable
  2017-08-04 11:52 ` [PATCH] " Joonas Lahtinen
@ 2017-08-04 12:15   ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2017-08-04 12:15 UTC (permalink / raw)
  To: Joonas Lahtinen, intel-gfx; +Cc: drm-intel-fixes

Quoting Joonas Lahtinen (2017-08-04 12:52:51)
> On pe, 2017-08-04 at 11:41 +0100, Chris Wilson wrote:
> > In order for us to successfully detect the end of a timeslice,
> > preemption must be disabled. Otherwise, inside the loop we may be
> > preempted many times without our noticing, and each time our timeslice
> > will be reset, invalidating need_resched()
> > 
> > Reported-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Reported-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
> > Fixes: 290271de34f6 ("drm/i915: Spin for struct_mutex inside shrinker")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.13-rc1+
> 
> Gets rid of the hang for my BDW.
> 
> Tested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Thanks for the overnight testing, pushed.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-08-04 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 10:41 [PATCH] drm/i915/shrinker: Wrap need_resched() inside preempt-disable Chris Wilson
2017-08-04 11:17 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-08-04 11:52 ` [PATCH] " Joonas Lahtinen
2017-08-04 12:15   ` Chris Wilson

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.