public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH igt 1/2] igt/gem_sync: Add a preemption test
@ 2017-09-28 17:26 Chris Wilson
  2017-09-28 17:26 ` [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-09-28 17:26 UTC (permalink / raw)
  To: intel-gfx

Check and measure how well we can submit a second high priority task
when the engine is already busy with a low priority task and see how
long it takes to complete (and wake up the client).

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

diff --git a/tests/gem_sync.c b/tests/gem_sync.c
index f9a2ebdf..8ed9760d 100644
--- a/tests/gem_sync.c
+++ b/tests/gem_sync.c
@@ -27,12 +27,22 @@
 #include "igt.h"
 #include "igt_sysfs.h"
 
+#define BIT(x) (1ul << (x))
+
 #define LOCAL_I915_EXEC_NO_RELOC (1<<11)
 #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
 
 #define LOCAL_I915_EXEC_BSD_SHIFT      (13)
 #define LOCAL_I915_EXEC_BSD_MASK       (3 << LOCAL_I915_EXEC_BSD_SHIFT)
 
+#define LOCAL_PARAM_HAS_SCHEDULER 41
+#define   HAS_SCHEDULER		BIT(0)
+#define   HAS_PRIORITY		BIT(1)
+#define   HAS_PREEMPTION	BIT(2)
+#define LOCAL_CONTEXT_PARAM_PRIORITY 6
+#define   MAX_PRIO 1023
+#define   MIN_PRIO -1023
+
 #define ENGINE_MASK  (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
 
 IGT_TEST_DESCRIPTION("Basic check of ring<->ring write synchronisation.");
@@ -684,6 +694,116 @@ store_all(int fd, int num_children, int timeout)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
+static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
+{
+	struct local_i915_gem_context_param param;
+
+	memset(&param, 0, sizeof(param));
+	param.context = ctx;
+	param.size = 0;
+	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
+	param.value = prio;
+
+	return __gem_context_set_param(fd, &param);
+}
+
+static void ctx_set_priority(int fd, uint32_t ctx, int prio)
+{
+	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
+}
+
+static void
+preempt(int fd, unsigned ring, int num_children, int timeout)
+{
+	unsigned engines[16];
+	const char *names[16];
+	int num_engines = 0;
+	uint32_t ctx[2];
+
+	if (ring == ~0u) {
+		const struct intel_execution_engine *e;
+
+		for (e = intel_execution_engines; e->name; e++) {
+			if (e->exec_id == 0)
+				continue;
+
+			if (!gem_has_ring(fd, e->exec_id | e->flags))
+				continue;
+
+			if (e->exec_id == I915_EXEC_BSD) {
+				int is_bsd2 = e->flags != 0;
+				if (gem_has_bsd2(fd) != is_bsd2)
+					continue;
+			}
+
+			names[num_engines] = e->name;
+			engines[num_engines++] = e->exec_id | e->flags;
+			if (num_engines == ARRAY_SIZE(engines))
+				break;
+		}
+
+		num_children *= num_engines;
+	} else {
+		gem_require_ring(fd, ring);
+		names[num_engines] = NULL;
+		engines[num_engines++] = ring;
+	}
+
+	ctx[0] = gem_context_create(fd);
+	ctx_set_priority(fd, ctx[0], MIN_PRIO);
+
+	ctx[1] = gem_context_create(fd);
+	ctx_set_priority(fd, ctx[1], MAX_PRIO);
+
+	intel_detect_and_clear_missed_interrupts(fd);
+	igt_fork(child, num_children) {
+		const uint32_t bbe = MI_BATCH_BUFFER_END;
+		struct drm_i915_gem_exec_object2 object;
+		struct drm_i915_gem_execbuffer2 execbuf;
+		double start, elapsed;
+		unsigned long cycles;
+
+		memset(&object, 0, sizeof(object));
+		object.handle = gem_create(fd, 4096);
+		gem_write(fd, object.handle, 0, &bbe, sizeof(bbe));
+
+		memset(&execbuf, 0, sizeof(execbuf));
+		execbuf.buffers_ptr = to_user_pointer(&object);
+		execbuf.buffer_count = 1;
+		execbuf.flags = engines[child % num_engines];
+		execbuf.rsvd1 = ctx[1];
+		gem_execbuf(fd, &execbuf);
+
+		start = gettime();
+		cycles = 0;
+		do {
+			igt_spin_t *spin =
+				__igt_spin_batch_new(fd,
+						     ctx[0],
+						     execbuf.flags,
+						     0);
+
+			do {
+				gem_execbuf(fd, &execbuf);
+				gem_sync(fd, object.handle);
+			} while (++cycles & 1023);
+
+			igt_spin_batch_free(fd, spin);
+		} while ((elapsed = gettime() - start) < timeout);
+		igt_info("%s%sompleted %ld cycles: %.3f us\n",
+			 names[child % num_engines] ?: "",
+			 names[child % num_engines] ? " c" : "C",
+			 cycles, elapsed*1e6/cycles);
+
+		gem_close(fd, object.handle);
+	}
+	igt_waitchildren_timeout(timeout+10, NULL);
+	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
+
+	gem_context_destroy(fd, ctx[1]);
+	gem_context_destroy(fd, ctx[0]);
+}
+
 static void print_welcome(int fd)
 {
 	bool active;
@@ -713,10 +833,32 @@ out:
 	close(dir);
 }
 
+static unsigned int has_scheduler(int fd)
+{
+	drm_i915_getparam_t gp;
+	unsigned int caps = 0;
+
+	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
+	gp.value = (int *)&caps;
+	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+	if (!caps)
+		return 0;
+
+	igt_info("Has kernel scheduler\n");
+	if (caps & HAS_PRIORITY)
+		igt_info(" - With priority sorting\n");
+	if (caps & HAS_PREEMPTION)
+		igt_info(" - With preemption enabled\n");
+
+	return caps;
+}
+
 igt_main
 {
 	const struct intel_execution_engine *e;
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+	unsigned int sched_caps = 0;
 	int fd = -1;
 
 	igt_skip_on_simulation();
@@ -725,6 +867,7 @@ igt_main
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
 		print_welcome(fd);
+		sched_caps = has_scheduler(fd);
 
 		igt_fork_hang_detector(fd);
 	}
@@ -767,6 +910,21 @@ igt_main
 	igt_subtest("forked-store-all")
 		store_all(fd, ncpus, 150);
 
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(sched_caps & HAS_PRIORITY);
+			igt_require(sched_caps & HAS_PREEMPTION);
+		}
+
+		igt_subtest("preempt-all")
+			preempt(fd, -1, 1, 20);
+
+		for (e = intel_execution_engines; e->name; e++) {
+			igt_subtest_f("preempt-%s", e->name)
+				preempt(fd, e->exec_id | e->flags, ncpus, 150);
+		}
+	}
+
 	igt_fixture {
 		igt_stop_hang_detector();
 		close(fd);
-- 
2.14.2

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

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

* [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load
  2017-09-28 17:26 [PATCH igt 1/2] igt/gem_sync: Add a preemption test Chris Wilson
@ 2017-09-28 17:26 ` Chris Wilson
  2017-09-29  8:27   ` Joonas Lahtinen
  2017-09-28 17:59 ` ✓ Fi.CI.BAT: success for series starting with [1/2] igt/gem_sync: Add a preemption test Patchwork
  2017-09-29  8:20 ` [PATCH igt 1/2] " Joonas Lahtinen
  2 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2017-09-28 17:26 UTC (permalink / raw)
  To: intel-gfx

Measure how many high priority batches we can execute whilst running a
bg spinner.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_nop.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)

diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 03335a6d..b582285a 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -45,6 +45,8 @@
 #include <time.h>
 #include "drm.h"
 
+#define BIT(x) (1ul << (x))
+
 #define LOCAL_I915_EXEC_NO_RELOC (1<<11)
 #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
 
@@ -53,6 +55,14 @@
 
 #define ENGINE_FLAGS  (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
 
+#define LOCAL_PARAM_HAS_SCHEDULER 41
+#define   HAS_SCHEDULER		BIT(0)
+#define   HAS_PRIORITY		BIT(1)
+#define   HAS_PREEMPTION	BIT(2)
+#define LOCAL_CONTEXT_PARAM_PRIORITY 6
+#define   MAX_PRIO 1023
+#define   MIN_PRIO -1023
+
 #define FORKED 1
 #define CHAINED 2
 #define CONTEXT 4
@@ -582,6 +592,79 @@ static void fence_signal(int fd, uint32_t handle,
 	igt_info("Signal %s: %'lu cycles (%'lu signals): %.3fus\n",
 		 ring_name, count, signal, elapsed(&start, &now) * 1e6 / count);
 }
+static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
+{
+	struct local_i915_gem_context_param param;
+
+	memset(&param, 0, sizeof(param));
+	param.context = ctx;
+	param.size = 0;
+	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
+	param.value = prio;
+
+	return __gem_context_set_param(fd, &param);
+}
+
+static void ctx_set_priority(int fd, uint32_t ctx, int prio)
+{
+	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
+}
+
+static void preempt(int fd, uint32_t handle,
+		   unsigned ring_id, const char *ring_name)
+{
+	struct drm_i915_gem_execbuffer2 execbuf;
+	struct drm_i915_gem_exec_object2 obj;
+	struct timespec start, now;
+	unsigned long count;
+	uint32_t ctx[2];
+
+	gem_require_ring(fd, ring_id);
+
+	ctx[0] = gem_context_create(fd);
+	ctx_set_priority(fd, ctx[0], MIN_PRIO);
+
+	ctx[1] = gem_context_create(fd);
+	ctx_set_priority(fd, ctx[1], MAX_PRIO);
+
+	memset(&obj, 0, sizeof(obj));
+	obj.handle = handle;
+
+	memset(&execbuf, 0, sizeof(execbuf));
+	execbuf.buffers_ptr = to_user_pointer(&obj);
+	execbuf.buffer_count = 1;
+	execbuf.flags = ring_id;
+	execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
+	execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
+	if (__gem_execbuf(fd, &execbuf)) {
+		execbuf.flags = ring_id;
+		gem_execbuf(fd, &execbuf);
+	}
+	execbuf.rsvd1 = ctx[1];
+	intel_detect_and_clear_missed_interrupts(fd);
+
+	count = 0;
+	clock_gettime(CLOCK_MONOTONIC, &start);
+	do {
+		igt_spin_t *spin =
+			__igt_spin_batch_new(fd, ctx[0], ring_id, 0);
+
+		for (int loop = 0; loop < 1024; loop++)
+			gem_execbuf(fd, &execbuf);
+
+		igt_spin_batch_free(fd, spin);
+
+		count += 1024;
+		clock_gettime(CLOCK_MONOTONIC, &now);
+	} while (elapsed(&start, &now) < 20);
+	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
+
+	gem_context_destroy(fd, ctx[1]);
+	gem_context_destroy(fd, ctx[0]);
+
+	igt_info("%s: %'lu cycles: %.3fus\n",
+		 ring_name, count, elapsed(&start, &now)*1e6 / count);
+}
 
 static void print_welcome(int fd)
 {
@@ -612,9 +695,31 @@ out:
 	close(dir);
 }
 
+static unsigned int has_scheduler(int fd)
+{
+	drm_i915_getparam_t gp;
+	unsigned int caps = 0;
+
+	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
+	gp.value = (int *)&caps;
+	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+	if (!caps)
+		return 0;
+
+	igt_info("Has kernel scheduler\n");
+	if (caps & HAS_PRIORITY)
+		igt_info(" - With priority sorting\n");
+	if (caps & HAS_PREEMPTION)
+		igt_info(" - With preemption enabled\n");
+
+	return caps;
+}
+
 igt_main
 {
 	const struct intel_execution_engine *e;
+	unsigned int sched_caps = 0;
 	uint32_t handle = 0;
 	int device = -1;
 
@@ -624,6 +729,7 @@ igt_main
 		device = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(device);
 		print_welcome(device);
+		sched_caps = has_scheduler(device);
 
 		handle = gem_create(device, 4096);
 		gem_write(device, handle, 0, &bbe, sizeof(bbe));
@@ -668,6 +774,18 @@ igt_main
 	igt_subtest("context-sequential")
 		sequential(device, handle, FORKED | CONTEXT, 150);
 
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(sched_caps & HAS_PRIORITY);
+			igt_require(sched_caps & HAS_PREEMPTION);
+		}
+
+		for (e = intel_execution_engines; e->name; e++) {
+			igt_subtest_f("preempt-%s", e->name)
+				preempt(device, handle, e->exec_id | e->flags, e->name);
+		}
+	}
+
 #if !defined(ANDROID) || ANDROID_HAS_CAIRO
 	igt_subtest("headless") {
 		/* Requires master for changing display modes */
-- 
2.14.2

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

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

* ✓ Fi.CI.BAT: success for series starting with [1/2] igt/gem_sync: Add a preemption test
  2017-09-28 17:26 [PATCH igt 1/2] igt/gem_sync: Add a preemption test Chris Wilson
  2017-09-28 17:26 ` [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load Chris Wilson
@ 2017-09-28 17:59 ` Patchwork
  2017-09-29  8:20 ` [PATCH igt 1/2] " Joonas Lahtinen
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-09-28 17:59 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/2] igt/gem_sync: Add a preemption test
URL   : https://patchwork.freedesktop.org/series/31088/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
3df22e0d2f8934311c62e4fd84bee24b32addb58 benchmarks/gem_exec_fault: Update for tryhard kernels.

with latest DRM-Tip kernel build CI_DRM_3151
7ae90fb62375 drm-tip: 2017y-09m-28d-16h-52m-04s UTC integration manifest

Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-cfl-s) fdo#102673

fdo#102673 https://bugs.freedesktop.org/show_bug.cgi?id=102673

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:473s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:422s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:519s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:283s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:506s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:520s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:499s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:496s
fi-cfl-s         total:246  pass:214  dwarn:1   dfail:0   fail:0   skip:30 
fi-cnl-y         total:289  pass:259  dwarn:0   dfail:0   fail:3   skip:27  time:664s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:423s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:569s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:432s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:402s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:434s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:492s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:465s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:475s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:582s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:588s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:551s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:754s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:490s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:475s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:568s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:416s

== Logs ==

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

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

* Re: [PATCH igt 1/2] igt/gem_sync: Add a preemption test
  2017-09-28 17:26 [PATCH igt 1/2] igt/gem_sync: Add a preemption test Chris Wilson
  2017-09-28 17:26 ` [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load Chris Wilson
  2017-09-28 17:59 ` ✓ Fi.CI.BAT: success for series starting with [1/2] igt/gem_sync: Add a preemption test Patchwork
@ 2017-09-29  8:20 ` Joonas Lahtinen
  2 siblings, 0 replies; 5+ messages in thread
From: Joonas Lahtinen @ 2017-09-29  8:20 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Thu, 2017-09-28 at 18:26 +0100, Chris Wilson wrote:
> Check and measure how well we can submit a second high priority task
> when the engine is already busy with a low priority task and see how
> long it takes to complete (and wake up the client).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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] 5+ messages in thread

* Re: [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load
  2017-09-28 17:26 ` [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load Chris Wilson
@ 2017-09-29  8:27   ` Joonas Lahtinen
  0 siblings, 0 replies; 5+ messages in thread
From: Joonas Lahtinen @ 2017-09-29  8:27 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Thu, 2017-09-28 at 18:26 +0100, Chris Wilson wrote:
> Measure how many high priority batches we can execute whilst running a
> bg spinner.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

<SNIP>

> @@ -582,6 +592,79 @@ static void fence_signal(int fd, uint32_t handle,
>  	igt_info("Signal %s: %'lu cycles (%'lu signals): %.3fus\n",
>  		 ring_name, count, signal, elapsed(&start, &now) * 1e6 / count);
>  }
> +static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
> +{
> +	struct local_i915_gem_context_param param;
> +
> +	memset(&param, 0, sizeof(param));
> +	param.context = ctx;
> +	param.size = 0;
> +	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
> +	param.value = prio;
> +
> +	return __gem_context_set_param(fd, &param);
> +}
> +
> +static void ctx_set_priority(int fd, uint32_t ctx, int prio)
> +{
> +	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
> +}
> +

I smell a lib/ function for this and the defines.

Maybe throw the commit message as a comment here.

> +static void preempt(int fd, uint32_t handle,
> +		   unsigned ring_id, const char *ring_name)
> +{
> +	struct drm_i915_gem_execbuffer2 execbuf;
> +	struct drm_i915_gem_exec_object2 obj;
> +	struct timespec start, now;
> +	unsigned long count;
> +	uint32_t ctx[2];
> +
> +	gem_require_ring(fd, ring_id);
> +
> +	ctx[0] = gem_context_create(fd);
> +	ctx_set_priority(fd, ctx[0], MIN_PRIO);
> +
> +	ctx[1] = gem_context_create(fd);
> +	ctx_set_priority(fd, ctx[1], MAX_PRIO);
> +
> +	memset(&obj, 0, sizeof(obj));
> +	obj.handle = handle;
> +
> +	memset(&execbuf, 0, sizeof(execbuf));
> +	execbuf.buffers_ptr = to_user_pointer(&obj);
> +	execbuf.buffer_count = 1;
> +	execbuf.flags = ring_id;
> +	execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
> +	execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
> +	if (__gem_execbuf(fd, &execbuf)) {
> +		execbuf.flags = ring_id;
> +		gem_execbuf(fd, &execbuf);
> +	}
> +	execbuf.rsvd1 = ctx[1];
> +	intel_detect_and_clear_missed_interrupts(fd);
> +
> +	count = 0;
> +	clock_gettime(CLOCK_MONOTONIC, &start);
> +	do {
> +		igt_spin_t *spin =
> +			__igt_spin_batch_new(fd, ctx[0], ring_id, 0);
> +
> +		for (int loop = 0; loop < 1024; loop++)
> +			gem_execbuf(fd, &execbuf);
> +
> +		igt_spin_batch_free(fd, spin);
> +
> +		count += 1024;

"count += loop" would make so much sense.

Would be an interesting statistic to know how many times the the
spinner got to ELSP.

> +static unsigned int has_scheduler(int fd)
> +{
> +	drm_i915_getparam_t gp;
> +	unsigned int caps = 0;
> +
> +	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
> +	gp.value = (int *)&caps;
> +	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
> +
> +	if (!caps)
> +		return 0;
> +
> +	igt_info("Has kernel scheduler\n");
> +	if (caps & HAS_PRIORITY)
> +		igt_info(" - With priority sorting\n");
> +	if (caps & HAS_PREEMPTION)
> +		igt_info(" - With preemption enabled\n");
> +
> +	return caps;
> +}

lib/ material again

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] 5+ messages in thread

end of thread, other threads:[~2017-09-29  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-28 17:26 [PATCH igt 1/2] igt/gem_sync: Add a preemption test Chris Wilson
2017-09-28 17:26 ` [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load Chris Wilson
2017-09-29  8:27   ` Joonas Lahtinen
2017-09-28 17:59 ` ✓ Fi.CI.BAT: success for series starting with [1/2] igt/gem_sync: Add a preemption test Patchwork
2017-09-29  8:20 ` [PATCH igt 1/2] " Joonas Lahtinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox