All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] lib: Spin fast, sweet chariot, coming to carry me home
@ 2018-06-19 13:55 ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-06-19 13:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

When using the pollable spinner, we often want to use it as a means of
ensuring the task is running on the GPU before switching to something
else. In which case we don't want to add extra delay inside the spinner,
but the current 1000 NOPs add on order of 5us, which is often larger
than the target latency.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_dummyload.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index d32b421c6..b090b8004 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -78,6 +78,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
 #define OUT_FENCE	(1 << 0)
 #define POLL_RUN	(1 << 1)
 #define NO_PREEMPTION   (1 << 2)
+#define SPIN_FAST       (1 << 3)
 
 static int
 emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
@@ -212,7 +213,8 @@ emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
 	 * between function calls, that appears enough to keep SNB out of
 	 * trouble. See https://bugs.freedesktop.org/show_bug.cgi?id=102262
 	 */
-	batch += 1000;
+	if (!(flags & SPIN_FAST))
+		batch += 1000;
 
 	/* recurse */
 	r = &relocs[obj[BATCH].relocation_count++];
@@ -369,7 +371,7 @@ igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
 igt_spin_t *
 __igt_spin_batch_new_poll(int fd, uint32_t ctx, unsigned engine)
 {
-	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN);
+	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN | SPIN_FAST);
 }
 
 igt_spin_t *
-- 
2.18.0.rc2

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

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

* [igt-dev] [PATCH i-g-t 1/2] lib: Spin fast, sweet chariot, coming to carry me home
@ 2018-06-19 13:55 ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-06-19 13:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

When using the pollable spinner, we often want to use it as a means of
ensuring the task is running on the GPU before switching to something
else. In which case we don't want to add extra delay inside the spinner,
but the current 1000 NOPs add on order of 5us, which is often larger
than the target latency.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_dummyload.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index d32b421c6..b090b8004 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -78,6 +78,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
 #define OUT_FENCE	(1 << 0)
 #define POLL_RUN	(1 << 1)
 #define NO_PREEMPTION   (1 << 2)
+#define SPIN_FAST       (1 << 3)
 
 static int
 emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
@@ -212,7 +213,8 @@ emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
 	 * between function calls, that appears enough to keep SNB out of
 	 * trouble. See https://bugs.freedesktop.org/show_bug.cgi?id=102262
 	 */
-	batch += 1000;
+	if (!(flags & SPIN_FAST))
+		batch += 1000;
 
 	/* recurse */
 	r = &relocs[obj[BATCH].relocation_count++];
@@ -369,7 +371,7 @@ igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
 igt_spin_t *
 __igt_spin_batch_new_poll(int fd, uint32_t ctx, unsigned engine)
 {
-	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN);
+	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN | SPIN_FAST);
 }
 
 igt_spin_t *
-- 
2.18.0.rc2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [PATCH i-g-t 2/2] igt/gem_sync: Show the baseline poll latency for wakeups
  2018-06-19 13:55 ` [igt-dev] " Chris Wilson
@ 2018-06-19 13:55   ` Chris Wilson
  -1 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-06-19 13:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Distinguish between the latency required to switch away from the
pollable spinner into the target nops from the client wakeup of
synchronisation on the last nop.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_sync.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/tests/gem_sync.c b/tests/gem_sync.c
index 5901e1476..a3e3d7ee8 100644
--- a/tests/gem_sync.c
+++ b/tests/gem_sync.c
@@ -207,7 +207,7 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
 		const uint32_t bbe = MI_BATCH_BUFFER_END;
 		struct drm_i915_gem_exec_object2 object;
 		struct drm_i915_gem_execbuffer2 execbuf;
-		double end, this, elapsed, now;
+		double end, this, elapsed, now, baseline;
 		unsigned long cycles;
 		uint32_t cmd;
 		igt_spin_t *spin;
@@ -230,6 +230,32 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
 		igt_spin_batch_end(spin);
 		gem_sync(fd, object.handle);
 
+		for (int warmup = 0; warmup <= 1; warmup++) {
+			end = gettime() + timeout/10.;
+			elapsed = 0;
+			cycles = 0;
+			do {
+				*spin->batch = cmd;
+				*spin->running = 0;
+				gem_execbuf(fd, &spin->execbuf);
+				while (!READ_ONCE(*spin->running))
+					;
+
+				this = gettime();
+				igt_spin_batch_end(spin);
+				gem_sync(fd, spin->handle);
+				now = gettime();
+
+				elapsed += now - this;
+				cycles++;
+			} while (now < end);
+			baseline = elapsed / cycles;
+		}
+		igt_info("%s%sasline %ld cycles: %.3f us\n",
+			 names[child % num_engines] ?: "",
+			 names[child % num_engines] ? " b" : "B",
+			 cycles, elapsed*1e6/cycles);
+
 		end = gettime() + timeout;
 		elapsed = 0;
 		cycles = 0;
@@ -251,11 +277,12 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
 			elapsed += now - this;
 			cycles++;
 		} while (now < end);
+		elapsed -= cycles * baseline;
 
-		igt_info("%s%sompleted %ld cycles: %.3f us\n",
+		igt_info("%s%sompleted %ld cycles: %.3f + %.3f us\n",
 			 names[child % num_engines] ?: "",
 			 names[child % num_engines] ? " c" : "C",
-			 cycles, elapsed*1e6/cycles);
+			 cycles, 1e6*baseline, elapsed*1e6/cycles);
 
 		igt_spin_batch_free(fd, spin);
 		gem_close(fd, object.handle);
-- 
2.18.0.rc2

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

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

* [igt-dev] [PATCH i-g-t 2/2] igt/gem_sync: Show the baseline poll latency for wakeups
@ 2018-06-19 13:55   ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-06-19 13:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Distinguish between the latency required to switch away from the
pollable spinner into the target nops from the client wakeup of
synchronisation on the last nop.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_sync.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/tests/gem_sync.c b/tests/gem_sync.c
index 5901e1476..a3e3d7ee8 100644
--- a/tests/gem_sync.c
+++ b/tests/gem_sync.c
@@ -207,7 +207,7 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
 		const uint32_t bbe = MI_BATCH_BUFFER_END;
 		struct drm_i915_gem_exec_object2 object;
 		struct drm_i915_gem_execbuffer2 execbuf;
-		double end, this, elapsed, now;
+		double end, this, elapsed, now, baseline;
 		unsigned long cycles;
 		uint32_t cmd;
 		igt_spin_t *spin;
@@ -230,6 +230,32 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
 		igt_spin_batch_end(spin);
 		gem_sync(fd, object.handle);
 
+		for (int warmup = 0; warmup <= 1; warmup++) {
+			end = gettime() + timeout/10.;
+			elapsed = 0;
+			cycles = 0;
+			do {
+				*spin->batch = cmd;
+				*spin->running = 0;
+				gem_execbuf(fd, &spin->execbuf);
+				while (!READ_ONCE(*spin->running))
+					;
+
+				this = gettime();
+				igt_spin_batch_end(spin);
+				gem_sync(fd, spin->handle);
+				now = gettime();
+
+				elapsed += now - this;
+				cycles++;
+			} while (now < end);
+			baseline = elapsed / cycles;
+		}
+		igt_info("%s%sasline %ld cycles: %.3f us\n",
+			 names[child % num_engines] ?: "",
+			 names[child % num_engines] ? " b" : "B",
+			 cycles, elapsed*1e6/cycles);
+
 		end = gettime() + timeout;
 		elapsed = 0;
 		cycles = 0;
@@ -251,11 +277,12 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
 			elapsed += now - this;
 			cycles++;
 		} while (now < end);
+		elapsed -= cycles * baseline;
 
-		igt_info("%s%sompleted %ld cycles: %.3f us\n",
+		igt_info("%s%sompleted %ld cycles: %.3f + %.3f us\n",
 			 names[child % num_engines] ?: "",
 			 names[child % num_engines] ? " c" : "C",
-			 cycles, elapsed*1e6/cycles);
+			 cycles, 1e6*baseline, elapsed*1e6/cycles);
 
 		igt_spin_batch_free(fd, spin);
 		gem_close(fd, object.handle);
-- 
2.18.0.rc2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] lib: Spin fast, sweet chariot, coming to carry me home
  2018-06-19 13:55 ` [igt-dev] " Chris Wilson
  (?)
  (?)
@ 2018-06-19 15:32 ` Patchwork
  -1 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-06-19 15:32 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/2] lib: Spin fast, sweet chariot, coming to carry me home
URL   : https://patchwork.freedesktop.org/series/45019/
State : failure

== Summary ==

Applying: lib: Spin fast, sweet chariot, coming to carry me home
Patch failed at 0001 lib: Spin fast, sweet chariot, coming to carry me home
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/2] lib: Spin fast, sweet chariot, coming to carry me home
  2018-06-19 13:55 ` [igt-dev] " Chris Wilson
@ 2018-06-19 18:46   ` Antonio Argenziano
  -1 siblings, 0 replies; 7+ messages in thread
From: Antonio Argenziano @ 2018-06-19 18:46 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev



On 19/06/18 06:55, Chris Wilson wrote:
> When using the pollable spinner, we often want to use it as a means of
> ensuring the task is running on the GPU before switching to something
> else. In which case we don't want to add extra delay inside the spinner,
> but the current 1000 NOPs add on order of 5us, which is often larger
> than the target latency.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>

> ---
>   lib/igt_dummyload.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index d32b421c6..b090b8004 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -78,6 +78,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
>   #define OUT_FENCE	(1 << 0)
>   #define POLL_RUN	(1 << 1)
>   #define NO_PREEMPTION   (1 << 2)
> +#define SPIN_FAST       (1 << 3)
>   
>   static int
>   emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
> @@ -212,7 +213,8 @@ emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
>   	 * between function calls, that appears enough to keep SNB out of
>   	 * trouble. See https://bugs.freedesktop.org/show_bug.cgi?id=102262
>   	 */
> -	batch += 1000;
> +	if (!(flags & SPIN_FAST))
> +		batch += 1000;
>   
>   	/* recurse */
>   	r = &relocs[obj[BATCH].relocation_count++];
> @@ -369,7 +371,7 @@ igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
>   igt_spin_t *
>   __igt_spin_batch_new_poll(int fd, uint32_t ctx, unsigned engine)
>   {
> -	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN);
> +	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN | SPIN_FAST);
>   }
>   
>   igt_spin_t *
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 1/2] lib: Spin fast, sweet chariot, coming to carry me home
@ 2018-06-19 18:46   ` Antonio Argenziano
  0 siblings, 0 replies; 7+ messages in thread
From: Antonio Argenziano @ 2018-06-19 18:46 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev



On 19/06/18 06:55, Chris Wilson wrote:
> When using the pollable spinner, we often want to use it as a means of
> ensuring the task is running on the GPU before switching to something
> else. In which case we don't want to add extra delay inside the spinner,
> but the current 1000 NOPs add on order of 5us, which is often larger
> than the target latency.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>

> ---
>   lib/igt_dummyload.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index d32b421c6..b090b8004 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -78,6 +78,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
>   #define OUT_FENCE	(1 << 0)
>   #define POLL_RUN	(1 << 1)
>   #define NO_PREEMPTION   (1 << 2)
> +#define SPIN_FAST       (1 << 3)
>   
>   static int
>   emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
> @@ -212,7 +213,8 @@ emit_recursive_batch(igt_spin_t *spin, int fd, uint32_t ctx, unsigned engine,
>   	 * between function calls, that appears enough to keep SNB out of
>   	 * trouble. See https://bugs.freedesktop.org/show_bug.cgi?id=102262
>   	 */
> -	batch += 1000;
> +	if (!(flags & SPIN_FAST))
> +		batch += 1000;
>   
>   	/* recurse */
>   	r = &relocs[obj[BATCH].relocation_count++];
> @@ -369,7 +371,7 @@ igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
>   igt_spin_t *
>   __igt_spin_batch_new_poll(int fd, uint32_t ctx, unsigned engine)
>   {
> -	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN);
> +	return ___igt_spin_batch_new(fd, ctx, engine, 0, POLL_RUN | SPIN_FAST);
>   }
>   
>   igt_spin_t *
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-06-19 18:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 13:55 [PATCH i-g-t 1/2] lib: Spin fast, sweet chariot, coming to carry me home Chris Wilson
2018-06-19 13:55 ` [igt-dev] " Chris Wilson
2018-06-19 13:55 ` [PATCH i-g-t 2/2] igt/gem_sync: Show the baseline poll latency for wakeups Chris Wilson
2018-06-19 13:55   ` [igt-dev] " Chris Wilson
2018-06-19 15:32 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] lib: Spin fast, sweet chariot, coming to carry me home Patchwork
2018-06-19 18:46 ` [igt-dev] [PATCH i-g-t 1/2] " Antonio Argenziano
2018-06-19 18:46   ` Antonio Argenziano

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.