All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Use exponential backoff for wait_for()
@ 2017-11-21 15:24 Chris Wilson
  2017-11-21 16:29 ` Sagar Arun Kamble
                   ` (9 more replies)
  0 siblings, 10 replies; 28+ messages in thread
From: Chris Wilson @ 2017-11-21 15:24 UTC (permalink / raw)
  To: intel-gfx

Instead of sleeping for a fixed 1ms (roughly, depending on timer slack),
start with a small sleep and exponentially increase the sleep on each
cycle.

A good example of a beneficiary is the guc mmio communication channel.
Typically we expect (and so spin) for 10us for a quick response, but this
doesn't cover everything and so sometimes we fallback to the millisecond+
sleep. This incurs a significant delay in time-critical operations like
preemption (igt/gem_exec_latency), which can be improved significantly by
using a small sleep after the spin fails.

We've made this suggestion many times, but had little experimental data
to support adding the complexity.

References: 1758b90e38f5 ("drm/i915: Use a hybrid scheme for fast register waits")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: John Harrison <John.C.Harrison@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 69aab324aaa1..c1ea9a009eb4 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -50,6 +50,7 @@
  */
 #define _wait_for(COND, US, W) ({ \
 	unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1;	\
+	long wait__ = 1;						\
 	int ret__;							\
 	might_sleep();							\
 	for (;;) {							\
@@ -62,7 +63,9 @@
 			ret__ = -ETIMEDOUT;				\
 			break;						\
 		}							\
-		usleep_range((W), (W) * 2);				\
+		usleep_range(wait__, wait__ * 2);			\
+		if (wait__ < (W))					\
+			wait__ <<= 1;					\
 	}								\
 	ret__;								\
 })
-- 
2.15.0

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

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

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

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 15:24 [PATCH] drm/i915: Use exponential backoff for wait_for() Chris Wilson
2017-11-21 16:29 ` Sagar Arun Kamble
2017-11-21 16:33   ` Chris Wilson
2017-11-21 16:49     ` Sagar Arun Kamble
2017-11-21 20:58       ` Chris Wilson
2017-11-21 16:50 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-11-21 17:00 ` [PATCH] " Tvrtko Ursulin
2017-11-21 17:11   ` Chris Wilson
2017-11-21 17:29     ` Ville Syrjälä
2017-11-21 20:40       ` Chris Wilson
2017-11-21 17:36 ` [PATCH v2] " Chris Wilson
2017-11-21 17:41 ` ✓ Fi.CI.IGT: success for " Patchwork
2017-11-21 18:03 ` ✓ Fi.CI.BAT: success for drm/i915: Use exponential backoff for wait_for() (rev2) Patchwork
2017-11-21 19:07 ` ✓ Fi.CI.IGT: " Patchwork
2017-11-21 20:59 ` [PATCH v3] drm/i915: Use exponential backoff for wait_for() Chris Wilson
2017-11-22  7:41   ` Sagar Arun Kamble
2017-11-22  9:36     ` Chris Wilson
2017-11-22  9:47       ` Michal Wajdeczko
2017-11-22 10:03       ` Sagar Arun Kamble
2017-11-24 12:37   ` Michał Winiarski
2017-11-24 14:12     ` Chris Wilson
2017-11-30  3:04       ` John Harrison
2017-11-30  6:19         ` Sagar Arun Kamble
2017-11-30  7:15           ` John Harrison
2017-11-30  7:55             ` Sagar Arun Kamble
2017-12-04 21:51               ` John Harrison
2017-11-21 21:32 ` ✓ Fi.CI.BAT: success for drm/i915: Use exponential backoff for wait_for() (rev3) Patchwork
2017-11-21 22:41 ` ✗ Fi.CI.IGT: warning " 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.