[PATCH i-g-t 4/4] tests/gem_exec_fence: Restore checks in *await-hang scenarios

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Tue Aug 2 23:00:48 UTC 2022


Reenable and fix checks disabled by commit
"tests/gem_exec_fence: Check stored values only for valid workloads".

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
 tests/i915/gem_exec_fence.c  | 50 ++++++++++++++++++++++++------------
 tests/intel-ci/blacklist.txt |  1 -
 2 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index 048870053a..124856e4fd 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -300,7 +300,7 @@ static unsigned int spin_hang(unsigned int flags)
 	if (!(flags & HANG))
 		return 0;
 
-	return IGT_SPIN_NO_PREEMPTION | IGT_SPIN_INVALID_CS;
+	return IGT_SPIN_FENCE_IN | IGT_SPIN_NO_PREEMPTION | IGT_SPIN_INVALID_CS;
 }
 
 static void test_fence_await(int fd, const intel_ctx_t *ctx,
@@ -309,10 +309,10 @@ static void test_fence_await(int fd, const intel_ctx_t *ctx,
 {
 	const struct intel_execution_engine2 *e2;
 	uint32_t scratch = gem_create(fd, 4096);
-	igt_spin_t *spin;
+	igt_spin_t *spin, invalid_spin;
 	uint32_t *out;
 	uint64_t scratch_offset, ahnd = get_reloc_ahnd(fd, ctx->id);
-	int i;
+	int out_fence, i;
 
 	scratch_offset = get_offset(ahnd, scratch, 4096, 0);
 
@@ -325,22 +325,36 @@ static void test_fence_await(int fd, const intel_ctx_t *ctx,
 			    .ctx = ctx,
 			    .engine = e->flags,
 			    .flags = IGT_SPIN_FENCE_OUT |
-				     IGT_SPIN_POLL_RUN |
-				     spin_hang(flags));
+				     IGT_SPIN_POLL_RUN);
 	igt_assert(spin->out_fence != -1);
 
+	if (flags & HANG) {
+		invalid_spin = igt_spin_new(fd,
+					    .ahnd = ahnd,
+					    .ctx = ctx,
+					    .engine = e->flags,
+					    .fence = spin->out_fence,
+					    .flags = IGT_SPIN_FENCE_OUT |
+						     IGT_SPIN_POLL_RUN |
+						     spin_hang(flags));
+		igt_assert(invalid_spin->out_fence != -1);
+		out_fence = invalid_spin->out_fence;
+	} else {
+		out_fence = spin->out_fence;
+	}
+
 	i = 0;
 	for_each_ctx_engine(fd, ctx, e2) {
 		if (!gem_class_can_store_dword(fd, e2->class))
 			continue;
 
 		if (flags & NONBLOCK) {
-			igt_store_word(fd, ahnd, ctx, e2, spin->out_fence,
+			igt_store_word(fd, ahnd, ctx, e2, out_fence,
 				       scratch, scratch_offset, i, i);
 		} else {
 			igt_fork(child, 1) {
 				ahnd = get_reloc_ahnd(fd, ctx->id);
-				igt_store_word(fd, ahnd, ctx, e2, spin->out_fence,
+				igt_store_word(fd, ahnd, ctx, e2, out_fence,
 					       scratch, scratch_offset, i, i);
 				put_ahnd(ahnd);
 			}
@@ -353,23 +367,25 @@ static void test_fence_await(int fd, const intel_ctx_t *ctx,
 	/* Long, but not too long to anger preemption disable checks */
 	usleep(50 * 1000); /* 50 ms, typical preempt reset is 150+ms */
 
-	if ((flags & HANG) == 0) {
-		/* Check for invalidly completing the task early */
-		igt_assert(fence_busy(spin->out_fence));
-		for (int n = 0; n < i; n++)
-			igt_assert_eq_u32(out[n], 0);
+	/* Check for invalidly completing the task early */
+	igt_assert(fence_busy(out_fence));
+	if (flags & HANG) {
+		igt_fail_on(igt_spin_has_started(invalid_spin));
+	for (int n = 0; n < i; n++)
+		igt_assert_eq_u32(out[n], 0);
 
-		igt_spin_end(spin);
-	}
+	igt_spin_end(spin);
 
 	igt_waitchildren();
 
 	gem_set_domain(fd, scratch, I915_GEM_DOMAIN_GTT, 0);
-	igt_assert(!fence_busy(spin->out_fence));
-	while ((flags & HANG) == 0 && i--)
-		igt_assert_eq_u32(out[i], i);
+	igt_assert(!fence_busy(out_fence));
+	while (i--)
+		igt_assert_eq_u32(out[i], flags & HANG ? 0 : i);
 	munmap(out, 4096);
 
+	if (flags & HANG)
+		igt_spin_free(fd, invalid_spin);
 	igt_spin_free(fd, spin);
 	gem_close(fd, scratch);
 	put_offset(ahnd, scratch);
diff --git a/tests/intel-ci/blacklist.txt b/tests/intel-ci/blacklist.txt
index 0d30773018..d9f0f52df5 100644
--- a/tests/intel-ci/blacklist.txt
+++ b/tests/intel-ci/blacklist.txt
@@ -25,7 +25,6 @@ igt at gem_evict_everything(@.*)?
 igt at gem_exec_big@(?!.*single).*
 igt at gem_exec_capture@many-(?!4K-).*
 igt at gem_exec_fair@(?!.*basic).*
-igt at gem_exec_fence@.*hang.*
 igt at gem_exec_flush@(?!.*basic).*
 igt at gem_exec_latency(@.*)?
 igt at gem_exec_lut_handle(@.*)?
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list