Skip to contentSkip to conversation

igt_dummyload: Wrap function parameters into struct

RFC In review Antonio Argenziano 3 participants 10 messages Dec 6, 2017 – Dec 7, 2017 Library code

lore
Share & tools
lore
#0 lore raw

RFC 1/5 igt_dummyload: Wrap function parameters into struct

The intent of this patch is to clean-up the interface of the spinning batch workload by grouping the parameters used to spawn it into a struct.

---
 lib/igt_dummyload.c       | 19 +++++++++++--------
 lib/igt_dummyload.h       | 16 ++++++++--------
 tests/drv_missed_irq.c    |  2 +-
 tests/gem_busy.c          | 14 +++++++-------
 tests/gem_exec_fence.c    | 14 +++++++-------
 tests/gem_exec_latency.c  |  2 +-
 tests/gem_exec_nop.c      |  2 +-
 tests/gem_exec_reloc.c    |  6 +++---
 tests/gem_exec_schedule.c |  8 ++++----
 tests/gem_exec_suspend.c  |  2 +-
 tests/gem_shrink.c        |  4 ++--
 tests/gem_spin_batch.c    |  4 ++--
 tests/gem_sync.c          |  4 ++--
 tests/gem_wait.c          |  2 +-
 tests/kms_busy.c          |  6 +++---
 tests/kms_cursor_legacy.c |  6 +++---
 tests/kms_flip.c          |  8 ++++----
 tests/perf_pmu.c          | 22 +++++++++++-----------
 tests/pm_rps.c            |  2 +-
 19 files changed, 73 insertions(+), 70 deletions(-)
lib/igt_dummyload.c +11 -8
index bb2be557..37ae5a03 100644
@@ -172,14 +172,14 @@ static void emit_recursive_batch(igt_spin_t *spin,
 }
 
 igt_spin_t *
-__igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
+__igt_spin_batch_new(int fd, igt_spin_opt_t opts)
 {
 	igt_spin_t *spin;
 
 	spin = calloc(1, sizeof(struct igt_spin));
 	igt_assert(spin);
 
-	emit_recursive_batch(spin, fd, ctx, engine, dep);
+	emit_recursive_batch(spin, fd, opts.ctx, opts.engine, opts.dep);
 	igt_assert(gem_bo_busy(fd, spin->handle));
 
 	igt_list_add(&spin->link, &spin_list);
@@ -190,10 +190,13 @@ __igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
 /**
  * igt_spin_batch_new:
  * @fd: open i915 drm file descriptor
- * @engine: Ring to execute batch OR'd with execbuf flags. If value is less
- *          than 0, execute on all available rings.
- * @dep: handle to a buffer object dependency. If greater than 0, add a
- *              relocation entry to this buffer within the batch.
+ * @opt: structure containing the parameters used by the call:
+ *		- ctx: Context that will be used to submit spinning batch. Provide 0
+ *				to use default context.
+ *		- engine: Ring to execute batch OR'd with execbuf flags. If value
+ *					is less than 0, execute on all available rings.
+ *		- dep: handle to a buffer object dependency. If greater than 0, add a
+ *				relocation entry to this buffer within the batch.
  *
  * Start a recursive batch on a ring. Immediately returns a #igt_spin_t that
  * contains the batch's handle that can be waited upon. The returned structure
@@ -203,11 +206,11 @@ __igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
  * Structure with helper internal state for igt_spin_batch_free().
  */
 igt_spin_t *
-igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
+igt_spin_batch_new(int fd, igt_spin_opt_t opts)
 {
 	igt_require_gem(fd);
 
-	return __igt_spin_batch_new(fd, ctx, engine, dep);
+	return __igt_spin_batch_new(fd, opts);
 }
 
 static void notify(union sigval arg)
lib/igt_dummyload.h +8 -8
index 215425f7..76ccd37a 100644
@@ -37,14 +37,14 @@ typedef struct igt_spin {
 	uint32_t *batch;
 } igt_spin_t;
 
-igt_spin_t *__igt_spin_batch_new(int fd,
-				 uint32_t ctx,
-				 unsigned engine,
-				 uint32_t  dep);
-igt_spin_t *igt_spin_batch_new(int fd,
-			       uint32_t ctx,
-			       unsigned engine,
-			       uint32_t  dep);
+typedef struct igt_spin_opt {
+	uint32_t ctx;
+	unsigned engine;
+	uint32_t dep;
+} igt_spin_opt_t;
+
+igt_spin_t *__igt_spin_batch_new(int fd, igt_spin_opt_t opts);
+igt_spin_t *igt_spin_batch_new(int fd, igt_spin_opt_t opts);
 void igt_spin_batch_set_timeout(igt_spin_t *spin, int64_t ns);
 void igt_spin_batch_end(igt_spin_t *spin);
 void igt_spin_batch_free(int fd, igt_spin_t *spin);
tests/drv_missed_irq.c +1 -1
index 9326a5a6..db67367b 100644
@@ -33,7 +33,7 @@ IGT_TEST_DESCRIPTION("Inject missed interrupts and make sure they are caught");
 
 static void trigger_missed_interrupt(int fd, unsigned ring)
 {
-	igt_spin_t *spin = __igt_spin_batch_new(fd, 0, ring, 0);
+	igt_spin_t *spin = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, 0});
 
 	igt_fork(child, 1) {
 		/* We are now a low priority child on the *same* CPU as the
tests/gem_busy.c +7 -7
index 4ba23241..119db4e2 100644
@@ -113,7 +113,7 @@ static void semaphore(int fd, unsigned ring, uint32_t flags)
 
 	/* Create a long running batch which we can use to hog the GPU */
 	handle[BUSY] = gem_create(fd, 4096);
-	spin = igt_spin_batch_new(fd, 0, ring, handle[BUSY]);
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, handle[BUSY]});
 
 	/* Queue a batch after the busy, it should block and remain "busy" */
 	igt_assert(exec_noop(fd, handle, ring | flags, false));
@@ -459,17 +459,17 @@ static void close_race(int fd)
 		igt_assert(sched_setscheduler(getpid(), SCHED_RR, &rt) == 0);
 
 		for (i = 0; i < nhandles; i++) {
-			spin[i] = igt_spin_batch_new(fd, 0,
-						     engines[rand() % nengine], 0);
+			spin[i] = igt_spin_batch_new(fd, (igt_spin_opt_t){0,
+						     engines[rand() % nengine], 0});
 			handles[i] = spin[i]->handle;
 		}
 
 		igt_until_timeout(20) {
 			for (i = 0; i < nhandles; i++) {
 				igt_spin_batch_free(fd, spin[i]);
-				spin[i] = igt_spin_batch_new(fd, 0,
+				spin[i] = igt_spin_batch_new(fd, (igt_spin_opt_t){0,
 							     engines[rand() % nengine],
-							     0);
+							     0});
 				handles[i] = spin[i]->handle;
 				__sync_synchronize();
 			}
@@ -511,7 +511,7 @@ static bool has_semaphores(int fd)
 
 static bool has_extended_busy_ioctl(int fd)
 {
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, I915_EXEC_RENDER, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
 	uint32_t read, write;
 
 	__gem_busy(fd, spin->handle, &read, &write);
@@ -522,7 +522,7 @@ static bool has_extended_busy_ioctl(int fd)
 
 static void basic(int fd, unsigned ring, unsigned flags)
 {
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, ring, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, 0});
 	struct timespec tv;
 	int timeout;
 	bool busy;
tests/gem_exec_fence.c +7 -7
index 6ee944ff..ddf61722 100644
@@ -438,7 +438,7 @@ static void test_parallel(int fd, unsigned int master)
 	/* Fill the queue with many requests so that the next one has to
 	 * wait before it can be executed by the hardware.
 	 */
-	spin = igt_spin_batch_new(fd, 0, master, c.handle);
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, master, c.handle});
 	resubmit(fd, spin->handle, master, 16);
 
 	/* Now queue the master request and its secondaries */
@@ -961,7 +961,7 @@ static void test_syncobj_unused_fence(int fd)
 	struct local_gem_exec_fence fence = {
 		.handle = syncobj_create(fd),
 	};
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, 0, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
 
 	/* sanity check our syncobj_to_sync_file interface */
 	igt_assert_eq(__syncobj_to_sync_file(fd, 0), -ENOENT);
@@ -1053,7 +1053,7 @@ static void test_syncobj_signal(int fd)
 	struct local_gem_exec_fence fence = {
 		.handle = syncobj_create(fd),
 	};
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, 0, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
 
 	/* Check that the syncobj is signaled only when our request/fence is */
 
@@ -1103,7 +1103,7 @@ static void test_syncobj_wait(int fd)
 
 	gem_quiescent_gpu(fd);
 
-	spin = igt_spin_batch_new(fd, 0, 0, 0);
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
 
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(&obj);
@@ -1173,7 +1173,7 @@ static void test_syncobj_export(int fd)
 		.handle = syncobj_create(fd),
 	};
 	int export[2];
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, 0, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
 
 	/* Check that if we export the syncobj prior to use it picks up
 	 * the later fence. This allows a syncobj to establish a channel
@@ -1231,7 +1231,7 @@ static void test_syncobj_repeat(int fd)
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct local_gem_exec_fence *fence;
 	int export;
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, 0, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
 
 	/* Check that we can wait on the same fence multiple times */
 	fence = calloc(nfences, sizeof(*fence));
@@ -1286,7 +1286,7 @@ static void test_syncobj_import(int fd)
 	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj;
 	struct drm_i915_gem_execbuffer2 execbuf;
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, 0, 0);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
 	uint32_t sync = syncobj_create(fd);
 	int fence;
 
tests/gem_exec_latency.c +1 -1
index 850404b9..32c1295d 100644
@@ -344,7 +344,7 @@ static void latency_from_ring(int fd,
 			       I915_GEM_DOMAIN_GTT);
 
 		if (flags & PREEMPT)
-			spin = igt_spin_batch_new(fd, ctx[0], ring, 0);
+			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[0], ring, 0});
 
 		if (flags & CORK) {
 			plug(fd, &c);
tests/gem_exec_nop.c +1 -1
index b5f15807..57f4b551 100644
@@ -620,7 +620,7 @@ static void preempt(int fd, uint32_t handle,
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	do {
 		igt_spin_t *spin =
-			__igt_spin_batch_new(fd, ctx[0], ring_id, 0);
+			__igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[0], ring_id, 0});
 
 		for (int loop = 0; loop < 1024; loop++)
 			gem_execbuf(fd, &execbuf);
tests/gem_exec_reloc.c +3 -3
index 432a42a9..cad9cc1f 100644
@@ -388,7 +388,7 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags)
 		}
 
 		if (flags & ACTIVE) {
-			spin = igt_spin_batch_new(fd, 0, I915_EXEC_DEFAULT, obj.handle);
+			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_DEFAULT, obj.handle});
 			if (!(flags & HANG))
 				igt_spin_batch_set_timeout(spin, NSEC_PER_SEC/100);
 			igt_assert(gem_bo_busy(fd, obj.handle));
@@ -454,7 +454,7 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags)
 		}
 
 		if (flags & ACTIVE) {
-			spin = igt_spin_batch_new(fd, 0, I915_EXEC_DEFAULT, obj.handle);
+			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_DEFAULT, obj.handle});
 			if (!(flags & HANG))
 				igt_spin_batch_set_timeout(spin, NSEC_PER_SEC/100);
 			igt_assert(gem_bo_busy(fd, obj.handle));
@@ -581,7 +581,7 @@ static void basic_range(int fd, unsigned flags)
 	execbuf.buffer_count = n + 1;
 
 	if (flags & ACTIVE) {
-		spin = igt_spin_batch_new(fd, 0, 0, obj[n].handle);
+		spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, obj[n].handle});
 		if (!(flags & HANG))
 			igt_spin_batch_set_timeout(spin, NSEC_PER_SEC/100);
 		igt_assert(gem_bo_busy(fd, obj[n].handle));
tests/gem_exec_schedule.c +4 -4
index a2f4419a..51f494a7 100644
@@ -147,7 +147,7 @@ static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)
 
 	for (int n = 0; n < ARRAY_SIZE(spin); n++) {
 		uint32_t ctx = create_highest_priority(fd);
-		spin[n] = __igt_spin_batch_new(fd, ctx, engine, 0);
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx, engine, 0});
 		gem_context_destroy(fd, ctx);
 	}
 
@@ -376,7 +376,7 @@ static void preempt(int fd, unsigned ring, unsigned flags)
 			ctx[LO] = gem_context_create(fd);
 			gem_context_set_priority(fd, ctx[LO], MIN_PRIO);
 		}
-		spin[n] = __igt_spin_batch_new(fd, ctx[LO], ring, 0);
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[LO], ring, 0});
 		igt_debug("spin[%d].handle=%d\n", n, spin[n]->handle);
 
 		store_dword(fd, ctx[HI], ring, result, 0, n + 1, 0, I915_GEM_DOMAIN_RENDER);
@@ -425,7 +425,7 @@ static void preempt_other(int fd, unsigned ring)
 
 	n = 0;
 	for_each_engine(fd, other) {
-		spin[n] = __igt_spin_batch_new(fd, ctx[NOISE], other, 0);
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[NOISE], other, 0});
 		store_dword(fd, ctx[LO], other,
 			    result, (n + 1)*sizeof(uint32_t), n + 1,
 			    0, I915_GEM_DOMAIN_RENDER);
@@ -478,7 +478,7 @@ static void preempt_self(int fd, unsigned ring)
 	n = 0;
 	gem_context_set_priority(fd, ctx[HI], MIN_PRIO);
 	for_each_engine(fd, other) {
-		spin[n] = __igt_spin_batch_new(fd, ctx[NOISE], other, 0);
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[NOISE], other, 0});
 		store_dword(fd, ctx[HI], other,
 			    result, (n + 1)*sizeof(uint32_t), n + 1,
 			    0, I915_GEM_DOMAIN_RENDER);
tests/gem_exec_suspend.c +1 -1
index bbdc6e55..8a83b11e 100644
@@ -201,7 +201,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)
 	}
 
 	if (flags & HANG)
-		spin = igt_spin_batch_new(fd, 0, engine, 0);
+		spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
 
 	switch (mode(flags)) {
 	case NOSLEEP:
tests/gem_shrink.c +2 -2
index 06f7a301..13110d06 100644
@@ -311,9 +311,9 @@ static void reclaim(unsigned engine, int timeout)
 		} while (!*shared);
 	}
 
-	spin = igt_spin_batch_new(fd, 0, engine, 0);
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
 	igt_until_timeout(timeout) {
-		igt_spin_t *next = __igt_spin_batch_new(fd, 0, engine, 0);
+		igt_spin_t *next = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
 
 		igt_spin_batch_set_timeout(spin, timeout_100ms);
 		gem_sync(fd, spin->handle);
tests/gem_spin_batch.c +2 -2
index 89631130..37d1d6e9 100644
@@ -41,9 +41,9 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 	struct timespec itv = { };
 	uint64_t elapsed;
 
-	spin = igt_spin_batch_new(fd, 0, engine, 0);
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
 	while ((elapsed = igt_nsec_elapsed(&tv)) >> 30 < timeout_sec) {
-		igt_spin_t *next = __igt_spin_batch_new(fd, 0, engine, 0);
+		igt_spin_t *next = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
 
 		igt_spin_batch_set_timeout(spin,
 					   timeout_100ms - igt_nsec_elapsed(&itv));
tests/gem_sync.c +2 -2
index 36180aee..466cbc74 100644
@@ -756,10 +756,10 @@ preempt(int fd, unsigned ring, int num_children, int timeout)
 		cycles = 0;
 		do {
 			igt_spin_t *spin =
-				__igt_spin_batch_new(fd,
+				__igt_spin_batch_new(fd, (igt_spin_opt_t){
 						     ctx[0],
 						     execbuf.flags,
-						     0);
+						     0});
 
 			do {
 				gem_execbuf(fd, &execbuf);
tests/gem_wait.c +1 -1
index cf8c8154..845d8b21 100644
@@ -110,7 +110,7 @@ static void unplug(struct cork *c)
 static void basic(int fd, unsigned engine, unsigned flags)
 {
 	struct cork cork = plug(fd, flags);
-	igt_spin_t *spin = igt_spin_batch_new(fd, 0, engine, cork.handle);
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, cork.handle});
 	struct drm_i915_gem_wait wait = {
 	       	flags & WRITE ? cork.handle : spin->handle
        	};
tests/kms_busy.c +3 -3
index 0828a8b3..df949b97 100644
@@ -92,7 +92,7 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
 	struct drm_event_vblank ev;
 
 	igt_spin_t *t = igt_spin_batch_new(dpy->drm_fd,
-					   0, ring, fb->gem_handle);
+					   (igt_spin_opt_t){0, ring, fb->gem_handle});
 
 	if (modeset) {
 		/*
@@ -208,7 +208,7 @@ static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,
 				    struct igt_fb *busy_fb, unsigned ring)
 {
 	igt_spin_t *t = igt_spin_batch_new(dpy->drm_fd,
-					   0, ring, busy_fb->gem_handle);
+					   (igt_spin_opt_t){0, ring, busy_fb->gem_handle});
 	struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
 	unsigned flags = 0;
 	struct drm_event_vblank ev;
@@ -295,7 +295,7 @@ static void test_pageflip_modeset_hang(igt_display_t *dpy,
 
 	igt_display_commit2(dpy, dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
-	t = igt_spin_batch_new(dpy->drm_fd, 0, ring, fb.gem_handle);
+	t = igt_spin_batch_new(dpy->drm_fd, (igt_spin_opt_t){0, ring, fb.gem_handle});
 
 	do_or_die(drmModePageFlip(dpy->drm_fd, dpy->pipes[pipe].crtc_id, fb.fb_id, DRM_MODE_PAGE_FLIP_EVENT, &fb));
 
tests/kms_cursor_legacy.c +3 -3
index 5720dbef..21ada773 100644
@@ -532,7 +532,7 @@ static void basic_flip_cursor(igt_display_t *display,
 
 		spin = NULL;
 		if (flags & BASIC_BUSY)
-			spin = igt_spin_batch_new(display->drm_fd, 0, 0, fb_info.gem_handle);
+			spin = igt_spin_batch_new(display->drm_fd, (igt_spin_opt_t){0, 0, fb_info.gem_handle});
 
 		/* Start with a synchronous query to align with the vblank */
 		vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
@@ -1298,8 +1298,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 		int ncrcs;
 		static const int max_crcs = 8;
 
-		spin = igt_spin_batch_new(display->drm_fd, 0, 0,
-					  fb_info[1].gem_handle);
+		spin = igt_spin_batch_new(display->drm_fd, (igt_spin_opt_t){0, 0,
+					  fb_info[1].gem_handle});
 
 		vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
 
tests/kms_flip.c +4 -4
index 4d5579e4..18015904 100644
@@ -692,15 +692,15 @@ static unsigned int run_test_step(struct test_output *o)
 		o->current_fb_id = !o->current_fb_id;
 
 	if (o->flags & TEST_WITH_DUMMY_BCS) {
-		spin_bcs = igt_spin_batch_new(drm_fd, 0, I915_EXEC_BLT,
-					      o->fb_info[o->current_fb_id].gem_handle);
+		spin_bcs = igt_spin_batch_new(drm_fd, (igt_spin_opt_t){0, I915_EXEC_BLT,
+					      o->fb_info[o->current_fb_id].gem_handle});
 		igt_spin_batch_set_timeout(spin_bcs,
 					   NSEC_PER_SEC);
 	}
 
 	if (o->flags & TEST_WITH_DUMMY_RCS) {
-		spin_rcs = igt_spin_batch_new(drm_fd, 0, I915_EXEC_RENDER,
-					      o->fb_info[o->current_fb_id].gem_handle);
+		spin_rcs = igt_spin_batch_new(drm_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER,
+					      o->fb_info[o->current_fb_id].gem_handle});
 		igt_spin_batch_set_timeout(spin_rcs,
 					   NSEC_PER_SEC);
 	}
tests/perf_pmu.c +11 -11
index e872f4e5..e5aa563b 100644
@@ -141,7 +141,7 @@ single(int gem_fd, const struct intel_execution_engine2 *e, bool busy)
 	fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
 
 	if (busy) {
-		spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+		spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
 		igt_spin_batch_set_timeout(spin, batch_duration_ns);
 	} else {
 		usleep(batch_duration_ns / 1000);
@@ -203,7 +203,7 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
 
 	igt_assert_eq(i, num_engines);
 
-	spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
 	igt_spin_batch_set_timeout(spin, batch_duration_ns);
 
 	gem_sync(gem_fd, spin->handle);
@@ -248,8 +248,8 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
 		if (e == e_) {
 			idle_idx = i;
 		} else {
-			spin[i] = igt_spin_batch_new(gem_fd, 0,
-						     e2ring(gem_fd, e_), 0);
+			spin[i] = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0,
+						     e2ring(gem_fd, e_), 0});
 			igt_spin_batch_set_timeout(spin[i], batch_duration_ns);
 		}
 
@@ -297,7 +297,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines)
 		fd[i] = open_group(I915_PMU_ENGINE_BUSY(e->class, e->instance),
 				   fd[0]);
 
-		spin[i] = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+		spin[i] = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
 		igt_spin_batch_set_timeout(spin[i], batch_duration_ns);
 
 		i++;
@@ -328,7 +328,7 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, bool busy)
 	open_group(I915_PMU_ENGINE_WAIT(e->class, e->instance), fd);
 
 	if (busy) {
-		spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+		spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
 		igt_spin_batch_set_timeout(spin, batch_duration_ns);
 	} else {
 		usleep(batch_duration_ns / 1000);
@@ -647,7 +647,7 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
 	 */
 	fd[1] = open_pmu(config);
 
-	spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
 	igt_spin_batch_set_timeout(spin, 2 * batch_duration_ns);
 
 	slept = measured_usleep(batch_duration_ns / 1000);
@@ -752,7 +752,7 @@ static void cpu_hotplug(int gem_fd)
 	fd = perf_i915_open(I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0));
 	igt_assert(fd >= 0);
 
-	spin = igt_spin_batch_new(gem_fd, 0, I915_EXEC_RENDER, 0);
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
 
 	igt_nsec_elapsed(&start);
 
@@ -865,7 +865,7 @@ test_interrupts(int gem_fd)
 	gem_quiescent_gpu(gem_fd);
 
 	fd = open_pmu(I915_PMU_INTERRUPTS);
-	spin = igt_spin_batch_new(gem_fd, 0, 0, 0);
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, 0, 0});
 
 	obj.handle = gem_create(gem_fd, sz);
 	gem_write(gem_fd, obj.handle, sz - sizeof(bbe), &bbe, sizeof(bbe));
@@ -947,7 +947,7 @@ test_frequency(int gem_fd)
 
 	pmu_read_multi(fd, 2, start);
 
-	spin = igt_spin_batch_new(gem_fd, 0, I915_EXEC_RENDER, 0);
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
 	igt_spin_batch_set_timeout(spin, duration_ns);
 	gem_sync(gem_fd, spin->handle);
 
@@ -972,7 +972,7 @@ test_frequency(int gem_fd)
 
 	pmu_read_multi(fd, 2, start);
 
-	spin = igt_spin_batch_new(gem_fd, 0, I915_EXEC_RENDER, 0);
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
 	igt_spin_batch_set_timeout(spin, duration_ns);
 	gem_sync(gem_fd, spin->handle);
 
tests/pm_rps.c +1 -1
index cc94813e..234348da 100644
@@ -588,7 +588,7 @@ static void boost_freq(int fd, int *boost_freqs)
 	engine = I915_EXEC_RENDER;
 	if (intel_gen(lh.devid) >= 6)
 		engine = I915_EXEC_BLT;
-	load = igt_spin_batch_new(fd, 0, engine, 0);
+	load = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
 	/* Waiting will grant us a boost to maximum */
 	gem_wait(fd, load->handle, &timeout);
 
Signature · 6 lines
2.14.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RFC 2/5 igt_hang_ctx: Wrap parameters into struct

This patch wraps the parameters for the function used to hang a context (igt_hang_ctx) into a struct to cleanup the interface and make it easier to add more parameters.

---
 lib/igt_dummyload.c     | 25 ++++++++++++-------------
 lib/igt_gt.c            | 41 +++++++++++++++++++----------------------
 lib/igt_gt.h            | 14 +++++++++-----
 tests/drv_hangman.c     |  2 +-
 tests/gem_reset_stats.c |  4 ++--
 tests/gem_softpin.c     |  2 +-
 6 files changed, 44 insertions(+), 44 deletions(-)
lib/igt_dummyload.c +12 -13
index 37ae5a03..fee311f7 100644
@@ -70,8 +70,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
 }
 
 static void emit_recursive_batch(igt_spin_t *spin,
-				 int fd, uint32_t ctx, unsigned engine,
-				 uint32_t dep)
+				 int fd, igt_spin_opt_t opts)
 {
 #define SCRATCH 0
 #define BATCH 1
@@ -85,13 +84,13 @@ static void emit_recursive_batch(igt_spin_t *spin,
 	int i;
 
 	nengine = 0;
-	if (engine == -1) {
-		for_each_engine(fd, engine)
-			if (engine)
-				engines[nengine++] = engine;
+	if (opts.engine == -1) {
+		for_each_engine(fd, opts.engine)
+			if (opts.engine)
+				engines[nengine++] = opts.engine;
 	} else {
-		gem_require_ring(fd, engine);
-		engines[nengine++] = engine;
+		gem_require_ring(fd, opts.engine);
+		engines[nengine++] = opts.engine;
 	}
 	igt_require(nengine);
 
@@ -109,11 +108,11 @@ static void emit_recursive_batch(igt_spin_t *spin,
 			I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 	execbuf.buffer_count++;
 
-	if (dep) {
+	if (opts.dep) {
 		/* dummy write to dependency */
-		obj[SCRATCH].handle = dep;
+		obj[SCRATCH].handle = opts.dep;
 		fill_reloc(&relocs[obj[BATCH].relocation_count++],
-			   dep, 1020,
+			   opts.dep, 1020,
 			   I915_GEM_DOMAIN_RENDER,
 			   I915_GEM_DOMAIN_RENDER);
 		execbuf.buffer_count++;
@@ -162,7 +161,7 @@ static void emit_recursive_batch(igt_spin_t *spin,
 	obj[BATCH].relocs_ptr = to_user_pointer(relocs);
 
 	execbuf.buffers_ptr = to_user_pointer(obj + (2 - execbuf.buffer_count));
-	execbuf.rsvd1 = ctx;
+	execbuf.rsvd1 = opts.ctx;
 
 	for (i = 0; i < nengine; i++) {
 		execbuf.flags &= ~ENGINE_MASK;
@@ -179,7 +178,7 @@ __igt_spin_batch_new(int fd, igt_spin_opt_t opts)
 	spin = calloc(1, sizeof(struct igt_spin));
 	igt_assert(spin);
 
-	emit_recursive_batch(spin, fd, opts.ctx, opts.engine, opts.dep);
+	emit_recursive_batch(spin, fd, opts);
 	igt_assert(gem_bo_busy(fd, spin->handle));
 
 	igt_list_add(&spin->link, &spin_list);
lib/igt_gt.c +19 -22

86 lines not on this page · raw message

lib/igt_gt.h +9 -5
index 48ed48af..55de04d5 100644
@@ -36,16 +36,20 @@ typedef struct igt_hang {
 	unsigned flags;
 } igt_hang_t;
 
+typedef struct igt_hang_opt {
+	uint32_t ctx;
+	int ring;
+	unsigned flags;
+	uint64_t *offset;
+} igt_hang_opt_t;
+
 igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags);
 void igt_disallow_hang(int fd, igt_hang_t arg);
 
 #define HANG_POISON 0xc5c5c5c5
 
-igt_hang_t igt_hang_ctx(int fd,
-			uint32_t ctx,
-			int ring,
-			unsigned flags,
-			uint64_t *offset);
+igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts);
+
 #define HANG_ALLOW_BAN 1
 #define HANG_ALLOW_CAPTURE 2
 
tests/drv_hangman.c +1 -1
index 40c82257..75fb2364 100644
@@ -187,7 +187,7 @@ static void test_error_state_capture(unsigned ring_id,
 
 	clear_error_state();
 
-	hang = igt_hang_ctx(device, 0, ring_id, HANG_ALLOW_CAPTURE, &offset);
+	hang = igt_hang_ctx(device, (igt_hang_opt_t){0, ring_id, HANG_ALLOW_CAPTURE, &offset});
 	batch = gem_mmap__cpu(device, hang.handle, 0, 4096, PROT_READ);
 	gem_set_domain(device, hang.handle, I915_GEM_DOMAIN_CPU, 0);
 	igt_post_hang_ring(device, hang);
tests/gem_reset_stats.c +2 -2
index edc40767..19174307 100644
@@ -161,7 +161,7 @@ static void inject_hang(int fd, uint32_t ctx,
 
 	clock_gettime(CLOCK_MONOTONIC, &ts_injected);
 
-	hang = igt_hang_ctx(fd, ctx, e->exec_id | e->flags, flags & BAN, NULL);
+	hang = igt_hang_ctx(fd, (igt_hang_opt_t){ctx, e->exec_id | e->flags, flags & BAN, NULL});
 	if ((flags & ASYNC) == 0)
 		igt_post_hang_ring(fd, hang);
 }
@@ -543,7 +543,7 @@ static void test_close_pending_fork(const struct intel_execution_engine *e,
 
 	assert_reset_status(fd, fd, 0, RS_NO_ERROR);
 
-	hang = igt_hang_ctx(fd, 0, e->exec_id | e->flags, 0, NULL);
+	hang = igt_hang_ctx(fd, (igt_hang_opt_t){0, e->exec_id | e->flags, 0, NULL});
 	sleep(1);
 
 	/* Avoid helpers as we need to kill the child
tests/gem_softpin.c +1 -1
index 99388599..9256138a 100644
@@ -359,7 +359,7 @@ static void test_evict_hang(int fd)
 	execbuf.buffers_ptr = to_user_pointer(&object);
 	execbuf.buffer_count = 1;
 
-	hang = igt_hang_ctx(fd, 0, 0, 0, (uint64_t *)&expected);
+	hang = igt_hang_ctx(fd, (igt_hang_opt_t){0, 0, 0, (uint64_t *)&expected});
 	object.offset = expected;
 	object.flags = EXEC_OBJECT_PINNED;
 
Signature · 6 lines
2.14.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

RFC 3/5 lib/igt_hang_ctx: Use dummyload batch to hang ctx.

In reply to Antonio Argenziano

To hang a context we were effectively reimplementing a spinning batch and never stopping it. This patch reuses the recursive batch from igt_dummyload to hang a context.

---
 lib/igt_dummyload.c |  4 +++-
 lib/igt_dummyload.h |  2 ++
 lib/igt_gt.c        | 38 ++++----------------------------------
 lib/igt_gt.h        |  1 +
 4 files changed, 10 insertions(+), 35 deletions(-)
lib/igt_dummyload.c +3 -1
index fee311f7..0bb02e5b 100644
@@ -69,7 +69,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
 	reloc->write_domain = write_domains;
 }
 
-static void emit_recursive_batch(igt_spin_t *spin,
+void emit_recursive_batch(igt_spin_t *spin,
 				 int fd, igt_spin_opt_t opts)
 {
 #define SCRATCH 0
@@ -168,6 +168,8 @@ static void emit_recursive_batch(igt_spin_t *spin,
 		execbuf.flags = engines[i];
 		gem_execbuf(fd, &execbuf);
 	}
+
+	spin->spinning_offset = obj->offset;
 }
 
 igt_spin_t *
lib/igt_dummyload.h +2 -0
index 76ccd37a..2f3f2ebf 100644
@@ -35,6 +35,7 @@ typedef struct igt_spin {
 	timer_t timer;
 	struct igt_list link;
 	uint32_t *batch;
+	uint64_t spinning_offset;
 } igt_spin_t;
 
 typedef struct igt_spin_opt {
@@ -43,6 +44,7 @@ typedef struct igt_spin_opt {
 	uint32_t dep;
 } igt_spin_opt_t;
 
+void emit_recursive_batch(igt_spin_t *spin, int fd, igt_spin_opt_t opts);
 igt_spin_t *__igt_spin_batch_new(int fd, igt_spin_opt_t opts);
 igt_spin_t *igt_spin_batch_new(int fd, igt_spin_opt_t opts);
 void igt_spin_batch_set_timeout(igt_spin_t *spin, int64_t ns);
lib/igt_gt.c +4 -34
index c9a2b508..9ec3b0f6 100644
@@ -266,13 +266,9 @@ static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)
  */
 igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
 {
-	struct drm_i915_gem_relocation_entry reloc;
-	struct drm_i915_gem_execbuffer2 execbuf;
-	struct drm_i915_gem_exec_object2 exec;
 	struct drm_i915_gem_context_param param;
-	uint32_t b[16];
 	unsigned ban;
-	unsigned len;
+	igt_spin_t spin;
 
 	igt_require_hang_ring(fd, opts.ring);
 
@@ -297,38 +293,12 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
 	if ((opts.flags & HANG_ALLOW_BAN) == 0)
 		context_set_ban(fd, opts.ctx, 0);
 
-	memset(&reloc, 0, sizeof(reloc));
-	memset(&exec, 0, sizeof(exec));
-	memset(&execbuf, 0, sizeof(execbuf));
-
-	exec.handle = gem_create(fd, 4096);
-	exec.relocation_count = 1;
-	exec.relocs_ptr = to_user_pointer(&reloc);
-
-	memset(b, 0xc5, sizeof(b));
-
-	len = 2;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
-		len++;
-	b[0] = MI_BATCH_BUFFER_START | (len - 2);
-	b[len] = MI_BATCH_BUFFER_END;
-	b[len+1] = MI_NOOP;
-	gem_write(fd, exec.handle, 0, b, sizeof(b));
-
-	reloc.offset = sizeof(uint32_t);
-	reloc.target_handle = exec.handle;
-	reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
-
-	execbuf.buffers_ptr = to_user_pointer(&exec);
-	execbuf.buffer_count = 1;
-	execbuf.flags = opts.ring;
-	i915_execbuffer2_set_context_id(execbuf, opts.ctx);
-	gem_execbuf(fd, &execbuf);
+	emit_recursive_batch(&spin, fd, (igt_spin_opt_t){opts.ctx, opts.ring, 0});
 
 	if (opts.offset)
-		*opts.offset = exec.offset;
+		*opts.offset = spin.spinning_offset;
 
-	return (igt_hang_t){ exec.handle, opts.ctx, ban, opts.flags };
+	return (igt_hang_t){ spin.handle, opts.ctx, ban, opts.flags };
 }
 
 /**
lib/igt_gt.h +1 -0
index 55de04d5..3f3e2d96 100644
@@ -26,6 +26,7 @@
 
 #include "igt_debugfs.h"
 #include "igt_core.h"
+#include "igt_dummyload.h"
 
 void igt_require_hang_ring(int fd, int ring);
 
Signature · 6 lines
2.14.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [RFC i-g-t 3/5] lib/igt_hang_ctx: Use dummyload batch to hang ctx.

Quoting Antonio Argenziano (2017-12-06 23:03:44)

Quoted 9 lines

To hang a context we were effectively reimplementing a spinning batch and never stopping it. This patch reuses the recursive batch from igt_dummyload to hang a context.

---
#define SCRATCH 0

lib/igt_dummyload.c static void emit_recursive_batch(igt_spin_t *spin, · line 172

Quoted 5 lines
lib/igt_dummyload.c +2 -0
@@ -168,6 +168,8 @@ static void emit_recursive_batch(igt_spin_t *spin,
                execbuf.flags = engines[i];
                gem_execbuf(fd, &execbuf);
        }
+
+       spin->spinning_offset = obj->offset;

s/spinning_offset/gtt_offset;

spin->gtt_offset = obj[BATCH].offset;

which should fix up the CI failures.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [RFC i-g-t 3/5] lib/igt_hang_ctx: Use dummyload batch to hang ctx.

Quoted 5 lines · Chris Wilson

Quoting Antonio Argenziano (2017-12-06 23:03:44)

Quoted 4 lines

To hang a context we were effectively reimplementing a spinning batch and never stopping it. This patch reuses the recursive batch from igt_dummyload to hang a context.

Quoted 13 lines

lib/igt_dummyload.c static void emit_recursive_batch(igt_spin_t *spin, · line 172

Quoted 10 lines

---
#define SCRATCH 0

lib/igt_dummyload.c +2 -0
@@ -168,6 +168,8 @@ static void emit_recursive_batch(igt_spin_t *spin,
                 execbuf.flags = engines[i];
                 gem_execbuf(fd, &execbuf);
         }
+
+       spin->spinning_offset = obj->offset;

s/spinning_offset/gtt_offset;

Quoted 1 line
(quoted diff) +0 -0
 spin->gtt_offset = obj[BATCH].offset;

Ops, thanks for catching this.

-Antonio

Quoted 4 lines

which should fix up the CI failures.
-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

RFC 4/5 igt_dummyload: Add preemptible parameter to spin batch

In reply to Antonio Argenziano

This patch adds a parameter that allows to make the spinning batch pre-emptible by adding an arbitration point to the spinning loop.

---
 lib/igt_dummyload.c       |  4 ++--
 lib/igt_dummyload.h       |  1 +
 lib/igt_gt.c              |  3 ++-
 tests/drv_missed_irq.c    |  2 +-
 tests/gem_busy.c          | 10 +++++-----
 tests/gem_exec_fence.c    | 14 +++++++-------
 tests/gem_exec_latency.c  |  2 +-
 tests/gem_exec_nop.c      |  2 +-
 tests/gem_exec_reloc.c    |  6 +++---
 tests/gem_exec_schedule.c |  8 ++++----
 tests/gem_exec_suspend.c  |  2 +-
 tests/gem_shrink.c        |  4 ++--
 tests/gem_spin_batch.c    |  4 ++--
 tests/gem_wait.c          |  2 +-
 tests/kms_busy.c          |  6 +++---
 tests/kms_cursor_legacy.c |  2 +-
 tests/perf_pmu.c          | 18 +++++++++---------
 tests/pm_rps.c            |  2 +-
 18 files changed, 47 insertions(+), 45 deletions(-)
lib/igt_dummyload.c +2 -2
index 0bb02e5b..cf5b29d5 100644
@@ -121,8 +121,8 @@ void emit_recursive_batch(igt_spin_t *spin,
 	spin->batch = batch;
 	spin->handle = obj[BATCH].handle;
 
-	/* Allow ourselves to be preempted */
-	*batch++ = MI_ARB_CHK;
+	if (opts.preemptible)
+		*batch++ = MI_ARB_CHK; /* Allow ourselves to be preempted */
 
 	/* Pad with a few nops so that we do not completely hog the system.
 	 *
lib/igt_dummyload.h +1 -0
index 2f3f2ebf..c285ece8 100644
@@ -42,6 +42,7 @@ typedef struct igt_spin_opt {
 	uint32_t ctx;
 	unsigned engine;
 	uint32_t dep;
+	bool preemptible;
 } igt_spin_opt_t;
 
 void emit_recursive_batch(igt_spin_t *spin, int fd, igt_spin_opt_t opts);
lib/igt_gt.c +2 -1
index 9ec3b0f6..48d40e61 100644
@@ -293,7 +293,8 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
 	if ((opts.flags & HANG_ALLOW_BAN) == 0)
 		context_set_ban(fd, opts.ctx, 0);
 
-	emit_recursive_batch(&spin, fd, (igt_spin_opt_t){opts.ctx, opts.ring, 0});
+	emit_recursive_batch(&spin, fd,
+			(igt_spin_opt_t){opts.ctx, opts.ring, 0, false});
 
 	if (opts.offset)
 		*opts.offset = spin.spinning_offset;
tests/drv_missed_irq.c +1 -1
index db67367b..308b9b60 100644
@@ -33,7 +33,7 @@ IGT_TEST_DESCRIPTION("Inject missed interrupts and make sure they are caught");
 
 static void trigger_missed_interrupt(int fd, unsigned ring)
 {
-	igt_spin_t *spin = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, 0});
+	igt_spin_t *spin = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, 0, true});
 
 	igt_fork(child, 1) {
 		/* We are now a low priority child on the *same* CPU as the
tests/gem_busy.c +5 -5
index 119db4e2..b581a490 100644
@@ -113,7 +113,7 @@ static void semaphore(int fd, unsigned ring, uint32_t flags)
 
 	/* Create a long running batch which we can use to hog the GPU */
 	handle[BUSY] = gem_create(fd, 4096);
-	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, handle[BUSY]});
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, handle[BUSY], true});
 
 	/* Queue a batch after the busy, it should block and remain "busy" */
 	igt_assert(exec_noop(fd, handle, ring | flags, false));
@@ -460,7 +460,7 @@ static void close_race(int fd)
 
 		for (i = 0; i < nhandles; i++) {
 			spin[i] = igt_spin_batch_new(fd, (igt_spin_opt_t){0,
-						     engines[rand() % nengine], 0});
+						     engines[rand() % nengine], 0, true});
 			handles[i] = spin[i]->handle;
 		}
 
@@ -469,7 +469,7 @@ static void close_race(int fd)
 				igt_spin_batch_free(fd, spin[i]);
 				spin[i] = igt_spin_batch_new(fd, (igt_spin_opt_t){0,
 							     engines[rand() % nengine],
-							     0});
+							     0, true});
 				handles[i] = spin[i]->handle;
 				__sync_synchronize();
 			}
@@ -511,7 +511,7 @@ static bool has_semaphores(int fd)
 
 static bool has_extended_busy_ioctl(int fd)
 {
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0, true});
 	uint32_t read, write;
 
 	__gem_busy(fd, spin->handle, &read, &write);
@@ -522,7 +522,7 @@ static bool has_extended_busy_ioctl(int fd)
 
 static void basic(int fd, unsigned ring, unsigned flags)
 {
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, ring, 0, true});
 	struct timespec tv;
 	int timeout;
 	bool busy;
tests/gem_exec_fence.c +7 -7
index ddf61722..01ef6cb5 100644
@@ -438,7 +438,7 @@ static void test_parallel(int fd, unsigned int master)
 	/* Fill the queue with many requests so that the next one has to
 	 * wait before it can be executed by the hardware.
 	 */
-	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, master, c.handle});
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, master, c.handle, true});
 	resubmit(fd, spin->handle, master, 16);
 
 	/* Now queue the master request and its secondaries */
@@ -961,7 +961,7 @@ static void test_syncobj_unused_fence(int fd)
 	struct local_gem_exec_fence fence = {
 		.handle = syncobj_create(fd),
 	};
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0, true});
 
 	/* sanity check our syncobj_to_sync_file interface */
 	igt_assert_eq(__syncobj_to_sync_file(fd, 0), -ENOENT);
@@ -1053,7 +1053,7 @@ static void test_syncobj_signal(int fd)
 	struct local_gem_exec_fence fence = {
 		.handle = syncobj_create(fd),
 	};
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0, true});
 
 	/* Check that the syncobj is signaled only when our request/fence is */
 
@@ -1103,7 +1103,7 @@ static void test_syncobj_wait(int fd)
 
 	gem_quiescent_gpu(fd);
 
-	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0, true});
 
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(&obj);
@@ -1173,7 +1173,7 @@ static void test_syncobj_export(int fd)
 		.handle = syncobj_create(fd),
 	};
 	int export[2];
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0, true});
 
 	/* Check that if we export the syncobj prior to use it picks up
 	 * the later fence. This allows a syncobj to establish a channel
@@ -1231,7 +1231,7 @@ static void test_syncobj_repeat(int fd)
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct local_gem_exec_fence *fence;
 	int export;
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0, true});
 
 	/* Check that we can wait on the same fence multiple times */
 	fence = calloc(nfences, sizeof(*fence));
@@ -1286,7 +1286,7 @@ static void test_syncobj_import(int fd)
 	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj;
 	struct drm_i915_gem_execbuffer2 execbuf;
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, 0, true});
 	uint32_t sync = syncobj_create(fd);
 	int fence;
 
tests/gem_exec_latency.c +1 -1
index 32c1295d..c7248ae9 100644
@@ -344,7 +344,7 @@ static void latency_from_ring(int fd,
 			       I915_GEM_DOMAIN_GTT);
 
 		if (flags & PREEMPT)
-			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[0], ring, 0});
+			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[0], ring, 0, true});
 
 		if (flags & CORK) {
 			plug(fd, &c);
tests/gem_exec_nop.c +1 -1
index 57f4b551..6b119027 100644
@@ -620,7 +620,7 @@ static void preempt(int fd, uint32_t handle,
 	clock_gettime(CLOCK_MONOTONIC, &start);
 	do {
 		igt_spin_t *spin =
-			__igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[0], ring_id, 0});
+			__igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[0], ring_id, 0, true});
 
 		for (int loop = 0; loop < 1024; loop++)
 			gem_execbuf(fd, &execbuf);
tests/gem_exec_reloc.c +3 -3
index cad9cc1f..18f051a2 100644
@@ -388,7 +388,7 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags)
 		}
 
 		if (flags & ACTIVE) {
-			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_DEFAULT, obj.handle});
+			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_DEFAULT, obj.handle, true});
 			if (!(flags & HANG))
 				igt_spin_batch_set_timeout(spin, NSEC_PER_SEC/100);
 			igt_assert(gem_bo_busy(fd, obj.handle));
@@ -454,7 +454,7 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags)
 		}
 
 		if (flags & ACTIVE) {
-			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_DEFAULT, obj.handle});
+			spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, I915_EXEC_DEFAULT, obj.handle, true});
 			if (!(flags & HANG))
 				igt_spin_batch_set_timeout(spin, NSEC_PER_SEC/100);
 			igt_assert(gem_bo_busy(fd, obj.handle));
@@ -581,7 +581,7 @@ static void basic_range(int fd, unsigned flags)
 	execbuf.buffer_count = n + 1;
 
 	if (flags & ACTIVE) {
-		spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, obj[n].handle});
+		spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, 0, obj[n].handle, true});
 		if (!(flags & HANG))
 			igt_spin_batch_set_timeout(spin, NSEC_PER_SEC/100);
 		igt_assert(gem_bo_busy(fd, obj[n].handle));
tests/gem_exec_schedule.c +4 -4
index 51f494a7..0b88acd1 100644
@@ -147,7 +147,7 @@ static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)
 
 	for (int n = 0; n < ARRAY_SIZE(spin); n++) {
 		uint32_t ctx = create_highest_priority(fd);
-		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx, engine, 0});
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx, engine, 0, true});
 		gem_context_destroy(fd, ctx);
 	}
 
@@ -376,7 +376,7 @@ static void preempt(int fd, unsigned ring, unsigned flags)
 			ctx[LO] = gem_context_create(fd);
 			gem_context_set_priority(fd, ctx[LO], MIN_PRIO);
 		}
-		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[LO], ring, 0});
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[LO], ring, 0, true});
 		igt_debug("spin[%d].handle=%d\n", n, spin[n]->handle);
 
 		store_dword(fd, ctx[HI], ring, result, 0, n + 1, 0, I915_GEM_DOMAIN_RENDER);
@@ -425,7 +425,7 @@ static void preempt_other(int fd, unsigned ring)
 
 	n = 0;
 	for_each_engine(fd, other) {
-		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[NOISE], other, 0});
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[NOISE], other, 0, true});
 		store_dword(fd, ctx[LO], other,
 			    result, (n + 1)*sizeof(uint32_t), n + 1,
 			    0, I915_GEM_DOMAIN_RENDER);
@@ -478,7 +478,7 @@ static void preempt_self(int fd, unsigned ring)
 	n = 0;
 	gem_context_set_priority(fd, ctx[HI], MIN_PRIO);
 	for_each_engine(fd, other) {
-		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[NOISE], other, 0});
+		spin[n] = __igt_spin_batch_new(fd, (igt_spin_opt_t){ctx[NOISE], other, 0, true});
 		store_dword(fd, ctx[HI], other,
 			    result, (n + 1)*sizeof(uint32_t), n + 1,
 			    0, I915_GEM_DOMAIN_RENDER);
tests/gem_exec_suspend.c +1 -1
index 8a83b11e..1751ae6f 100644
@@ -201,7 +201,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)
 	}
 
 	if (flags & HANG)
-		spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
+		spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0, true});
 
 	switch (mode(flags)) {
 	case NOSLEEP:
tests/gem_shrink.c +2 -2
index 13110d06..dbc3b047 100644
@@ -311,9 +311,9 @@ static void reclaim(unsigned engine, int timeout)
 		} while (!*shared);
 	}
 
-	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0, true});
 	igt_until_timeout(timeout) {
-		igt_spin_t *next = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
+		igt_spin_t *next = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0, true});
 
 		igt_spin_batch_set_timeout(spin, timeout_100ms);
 		gem_sync(fd, spin->handle);
tests/gem_spin_batch.c +2 -2
index 37d1d6e9..785b6cf4 100644
@@ -41,9 +41,9 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 	struct timespec itv = { };
 	uint64_t elapsed;
 
-	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
+	spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0, true});
 	while ((elapsed = igt_nsec_elapsed(&tv)) >> 30 < timeout_sec) {
-		igt_spin_t *next = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
+		igt_spin_t *next = __igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0, true});
 
 		igt_spin_batch_set_timeout(spin,
 					   timeout_100ms - igt_nsec_elapsed(&itv));
tests/gem_wait.c +1 -1
index 845d8b21..cae3587b 100644
@@ -110,7 +110,7 @@ static void unplug(struct cork *c)
 static void basic(int fd, unsigned engine, unsigned flags)
 {
 	struct cork cork = plug(fd, flags);
-	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, cork.handle});
+	igt_spin_t *spin = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, cork.handle, true});
 	struct drm_i915_gem_wait wait = {
 	       	flags & WRITE ? cork.handle : spin->handle
        	};
tests/kms_busy.c +3 -3
index df949b97..9aa53e7c 100644
@@ -92,7 +92,7 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
 	struct drm_event_vblank ev;
 
 	igt_spin_t *t = igt_spin_batch_new(dpy->drm_fd,
-					   (igt_spin_opt_t){0, ring, fb->gem_handle});
+					   (igt_spin_opt_t){0, ring, fb->gem_handle, true});
 
 	if (modeset) {
 		/*
@@ -208,7 +208,7 @@ static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,
 				    struct igt_fb *busy_fb, unsigned ring)
 {
 	igt_spin_t *t = igt_spin_batch_new(dpy->drm_fd,
-					   (igt_spin_opt_t){0, ring, busy_fb->gem_handle});
+					   (igt_spin_opt_t){0, ring, busy_fb->gem_handle, true});
 	struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
 	unsigned flags = 0;
 	struct drm_event_vblank ev;
@@ -295,7 +295,7 @@ static void test_pageflip_modeset_hang(igt_display_t *dpy,
 
 	igt_display_commit2(dpy, dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
-	t = igt_spin_batch_new(dpy->drm_fd, (igt_spin_opt_t){0, ring, fb.gem_handle});
+	t = igt_spin_batch_new(dpy->drm_fd, (igt_spin_opt_t){0, ring, fb.gem_handle, true});
 
 	do_or_die(drmModePageFlip(dpy->drm_fd, dpy->pipes[pipe].crtc_id, fb.fb_id, DRM_MODE_PAGE_FLIP_EVENT, &fb));
 
tests/kms_cursor_legacy.c +1 -1
index 21ada773..29ec00db 100644
@@ -532,7 +532,7 @@ static void basic_flip_cursor(igt_display_t *display,
 
 		spin = NULL;
 		if (flags & BASIC_BUSY)
-			spin = igt_spin_batch_new(display->drm_fd, (igt_spin_opt_t){0, 0, fb_info.gem_handle});
+			spin = igt_spin_batch_new(display->drm_fd, (igt_spin_opt_t){0, 0, fb_info.gem_handle, true});
 
 		/* Start with a synchronous query to align with the vblank */
 		vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
tests/perf_pmu.c +9 -9
index e5aa563b..d06b67a8 100644
@@ -141,7 +141,7 @@ single(int gem_fd, const struct intel_execution_engine2 *e, bool busy)
 	fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
 
 	if (busy) {
-		spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
+		spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0, true});
 		igt_spin_batch_set_timeout(spin, batch_duration_ns);
 	} else {
 		usleep(batch_duration_ns / 1000);
@@ -203,7 +203,7 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
 
 	igt_assert_eq(i, num_engines);
 
-	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0, true});
 	igt_spin_batch_set_timeout(spin, batch_duration_ns);
 
 	gem_sync(gem_fd, spin->handle);
@@ -297,7 +297,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines)
 		fd[i] = open_group(I915_PMU_ENGINE_BUSY(e->class, e->instance),
 				   fd[0]);
 
-		spin[i] = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
+		spin[i] = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0, true});
 		igt_spin_batch_set_timeout(spin[i], batch_duration_ns);
 
 		i++;
@@ -328,7 +328,7 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, bool busy)
 	open_group(I915_PMU_ENGINE_WAIT(e->class, e->instance), fd);
 
 	if (busy) {
-		spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
+		spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0, true});
 		igt_spin_batch_set_timeout(spin, batch_duration_ns);
 	} else {
 		usleep(batch_duration_ns / 1000);
@@ -647,7 +647,7 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
 	 */
 	fd[1] = open_pmu(config);
 
-	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0});
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, e2ring(gem_fd, e), 0, true});
 	igt_spin_batch_set_timeout(spin, 2 * batch_duration_ns);
 
 	slept = measured_usleep(batch_duration_ns / 1000);
@@ -752,7 +752,7 @@ static void cpu_hotplug(int gem_fd)
 	fd = perf_i915_open(I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0));
 	igt_assert(fd >= 0);
 
-	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0, true});
 
 	igt_nsec_elapsed(&start);
 
@@ -865,7 +865,7 @@ test_interrupts(int gem_fd)
 	gem_quiescent_gpu(gem_fd);
 
 	fd = open_pmu(I915_PMU_INTERRUPTS);
-	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, 0, 0});
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, 0, 0, true});
 
 	obj.handle = gem_create(gem_fd, sz);
 	gem_write(gem_fd, obj.handle, sz - sizeof(bbe), &bbe, sizeof(bbe));
@@ -947,7 +947,7 @@ test_frequency(int gem_fd)
 
 	pmu_read_multi(fd, 2, start);
 
-	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0, true});
 	igt_spin_batch_set_timeout(spin, duration_ns);
 	gem_sync(gem_fd, spin->handle);
 
@@ -972,7 +972,7 @@ test_frequency(int gem_fd)
 
 	pmu_read_multi(fd, 2, start);
 
-	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0});
+	spin = igt_spin_batch_new(gem_fd, (igt_spin_opt_t){0, I915_EXEC_RENDER, 0, true});
 	igt_spin_batch_set_timeout(spin, duration_ns);
 	gem_sync(gem_fd, spin->handle);
 
tests/pm_rps.c +1 -1
index 234348da..4e01a1e0 100644
@@ -588,7 +588,7 @@ static void boost_freq(int fd, int *boost_freqs)
 	engine = I915_EXEC_RENDER;
 	if (intel_gen(lh.devid) >= 6)
 		engine = I915_EXEC_BLT;
-	load = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0});
+	load = igt_spin_batch_new(fd, (igt_spin_opt_t){0, engine, 0, true});
 	/* Waiting will grant us a boost to maximum */
 	gem_wait(fd, load->handle, &timeout);
 
Signature · 6 lines
2.14.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [RFC i-g-t 4/5] igt_dummyload: Add preemptible parameter to spin batch

Quoting Antonio Argenziano (2017-12-06 23:03:45)

lib/igt_gt.c igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts) · line 297

Quoted 12 lines

void emit_recursive_batch(igt_spin_t *spin, int fd, igt_spin_opt_t opts);

lib/igt_gt.c +2 -1
index 9ec3b0f6..48d40e61 100644
@@ -293,7 +293,8 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
        if ((opts.flags & HANG_ALLOW_BAN) == 0)
                context_set_ban(fd, opts.ctx, 0);
 
-       emit_recursive_batch(&spin, fd, (igt_spin_opt_t){opts.ctx, opts.ring, 0});
+       emit_recursive_batch(&spin, fd,
+                       (igt_spin_opt_t){opts.ctx, opts.ring, 0, false});

The fun you can do with this is

	emit_recursive_batch(&spin, fd, (igt_spin_opt_t){
		.ctx = opts.ctx,
		.engine = opts.ring,
		/* anything unset is zero */
	});

which should make the changes much more palatable. Bonus points for currying common patterns.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

RFC 5/5 igt_hang_ctx: Add preemptible parameter

In reply to Antonio Argenziano

This patch adds a parameter to make the hanging context pre-emptible.

---
 lib/igt_gt.c            | 4 ++--
 lib/igt_gt.h            | 1 +
 tests/drv_hangman.c     | 2 +-
 tests/gem_reset_stats.c | 2 +-
 tests/gem_softpin.c     | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)
lib/igt_gt.c +2 -2
index 48d40e61..bc33e087 100644
@@ -294,7 +294,7 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
 		context_set_ban(fd, opts.ctx, 0);
 
 	emit_recursive_batch(&spin, fd,
-			(igt_spin_opt_t){opts.ctx, opts.ring, 0, false});
+			(igt_spin_opt_t){opts.ctx, opts.ring, 0, opts.preemptible});
 
 	if (opts.offset)
 		*opts.offset = spin.spinning_offset;
@@ -316,7 +316,7 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
  */
 igt_hang_t igt_hang_ring(int fd, int ring)
 {
-	return igt_hang_ctx(fd, (igt_hang_opt_t){0, ring, 0, NULL});
+	return igt_hang_ctx(fd, (igt_hang_opt_t){0, ring, 0, NULL, false});
 }
 
 /**
lib/igt_gt.h +1 -0
index 3f3e2d96..17fcee33 100644
@@ -42,6 +42,7 @@ typedef struct igt_hang_opt {
 	int ring;
 	unsigned flags;
 	uint64_t *offset;
+	bool preemptible;
 } igt_hang_opt_t;
 
 igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags);
tests/drv_hangman.c +1 -1
index 75fb2364..e9227a84 100644
@@ -187,7 +187,7 @@ static void test_error_state_capture(unsigned ring_id,
 
 	clear_error_state();
 
-	hang = igt_hang_ctx(device, (igt_hang_opt_t){0, ring_id, HANG_ALLOW_CAPTURE, &offset});
+	hang = igt_hang_ctx(device, (igt_hang_opt_t){0, ring_id, HANG_ALLOW_CAPTURE, &offset, false});
 	batch = gem_mmap__cpu(device, hang.handle, 0, 4096, PROT_READ);
 	gem_set_domain(device, hang.handle, I915_GEM_DOMAIN_CPU, 0);
 	igt_post_hang_ring(device, hang);
tests/gem_reset_stats.c +1 -1
index 19174307..c5024157 100644
@@ -161,7 +161,7 @@ static void inject_hang(int fd, uint32_t ctx,
 
 	clock_gettime(CLOCK_MONOTONIC, &ts_injected);
 
-	hang = igt_hang_ctx(fd, (igt_hang_opt_t){ctx, e->exec_id | e->flags, flags & BAN, NULL});
+	hang = igt_hang_ctx(fd, (igt_hang_opt_t){ctx, e->exec_id | e->flags, flags & BAN, NULL, false});
 	if ((flags & ASYNC) == 0)
 		igt_post_hang_ring(fd, hang);
 }
tests/gem_softpin.c +1 -1
index 9256138a..07b5712d 100644
@@ -359,7 +359,7 @@ static void test_evict_hang(int fd)
 	execbuf.buffers_ptr = to_user_pointer(&object);
 	execbuf.buffer_count = 1;
 
-	hang = igt_hang_ctx(fd, (igt_hang_opt_t){0, 0, 0, (uint64_t *)&expected});
+	hang = igt_hang_ctx(fd, (igt_hang_opt_t){0, 0, 0, (uint64_t *)&expected, false});
 	object.offset = expected;
 	object.flags = EXEC_OBJECT_PINNED;
 
Signature · 6 lines
2.14.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

✓ Fi.CI.BAT: success for series starting with [RFC,1/5] igt_dummyload: Wrap function parameters into struct

In reply to Antonio Argenziano
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/5] igt_dummyload: Wrap function parameters into struct
URL : https://patchwork.freedesktop.org/series/34997/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 1db12466cb5ad8483cd469753d2e312a62d717b7 meson: build a full dependency for lib_igt_perf

with latest DRM-Tip kernel build CI_DRM_3468
95f37eb3ebfd drm-tip: 2017y-12m-06d-21h-01m-04s UTC integration manifest

No testlist changes.

Test gem_mmap_gtt:

        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575

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

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:441s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:394s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:538s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:284s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:511s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:519s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:500s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:484s
fi-elk-e7500     total:224  pass:163  dwarn:14  dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:1   dfail:0   fail:0   skip:108 time:271s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:543s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:267s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:495s
fi-ivb-3770      total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:459s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:530s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:480s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:534s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:592s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:462s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:549s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:572s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:524s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:516s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:554s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:424s
Blacklisted hosts:
fi-cnl-y         total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:638s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:495s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_605/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

✗ Fi.CI.IGT: failure for series starting with [RFC,1/5] igt_dummyload: Wrap function parameters into struct

In reply to Antonio Argenziano
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/5] igt_dummyload: Wrap function parameters into struct
URL : https://patchwork.freedesktop.org/series/34997/
State : failure

== Summary ==

Test kms_flip:

        Subgroup wf_vblank:
                pass       -> DMESG-WARN (shard-hsw)
        Subgroup blt-wf_vblank-vs-modeset:
                pass       -> INCOMPLETE (shard-hsw)
Test kms_cursor_crc:
        Subgroup cursor-size-change:
                pass       -> FAIL       (shard-hsw)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                pass       -> INCOMPLETE (shard-hsw) fdo#103375
Test drv_hangman:
        Subgroup error-state-capture-render:
                pass       -> FAIL       (shard-snb)
        Subgroup error-state-capture-blt:
                pass       -> FAIL       (shard-snb)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                fail       -> PASS       (shard-snb) fdo#101623
Test pm_rc6_residency:
        Subgroup rc6-accuracy:
                pass       -> SKIP       (shard-snb)

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

shard-hsw        total:2584 pass:1484 dwarn:2   dfail:0   fail:11  skip:1085 time:9233s
shard-snb        total:2679 pass:1305 dwarn:1   dfail:0   fail:14  skip:1359 time:8322s
Blacklisted hosts:
shard-apl        total:2657 pass:1654 dwarn:2   dfail:0   fail:22  skip:977 time:13445s
shard-kbl        total:2554 pass:1703 dwarn:2   dfail:0   fail:21  skip:826 time:9936s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_605/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx