Skip to contentSkip to conversation

tests/gem_reset_stats: add defer-hangcheck test

PATCH In review Mika Kuoppala 2 participants 2 messages Nov 7, 2014 – Nov 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_reset_stats: add defer-hangcheck test

to see if one can fool hangcheck by keeping non hanging ring busy

---
 tests/gem_reset_stats.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
tests/gem_reset_stats.c +43 -0
index 3f5a01f..6473cf3 100644
@@ -1019,6 +1019,45 @@ static void test_params(void)
 
 }
 
+static void defer_hangcheck(int ring_num)
+{
+	int fd, count_start, count_end;
+	int seconds = 30;
+	const struct target_ring *next_ring;
+	fd = drm_open_any();
+	igt_assert(fd >= 0);
+
+	do {
+		next_ring = &rings[(++ring_num) % NUM_RINGS];
+
+		if (next_ring->present(fd))
+			break;
+
+	} while(next_ring != current_ring);
+
+	igt_skip_on(next_ring == current_ring);
+
+	count_start = get_reset_count(fd, 0);
+	igt_assert(count_start >= 0);
+
+	igt_assert(inject_hang_ring(fd, 0, current_ring->exec, true));
+	while (--seconds) {
+		igt_assert(exec_valid_ring(fd, 0, next_ring->exec));
+
+		count_end = get_reset_count(fd, 0);
+		igt_assert(count_end >= 0);
+
+		if (count_end > count_start)
+			return;
+
+		sleep(1);
+	}
+
+	igt_assert(count_end > count_start);
+
+	close(fd);
+}
+
 static bool gem_has_hw_contexts(int fd)
 {
 	struct local_drm_i915_gem_context_create create;
@@ -1159,5 +1198,9 @@ igt_main
 
 		igt_subtest_f("close-pending-fork-reverse-%s", name)
 			RUN_TEST(test_close_pending_fork(true));
+
+		igt_subtest_f("defer-hangcheck-%s", name)
+			RUN_TEST(defer_hangcheck(i));
+
 	}
 }
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 37 lines · Mika Kuoppala

to see if one can fool hangcheck by keeping non hanging ring busy

---
 tests/gem_reset_stats.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
tests/gem_reset_stats.c +20 -0
index 3f5a01f..6473cf3 100644
@@ -1019,6 +1019,45 @@ static void test_params(void)
 
 }
 
+static void defer_hangcheck(int ring_num)
+{
+	int fd, count_start, count_end;
+	int seconds = 30;
+	const struct target_ring *next_ring;
+	fd = drm_open_any();
+	igt_assert(fd >= 0);
+
+	do {
+		next_ring = &rings[(++ring_num) % NUM_RINGS];
+
+		if (next_ring->present(fd))
+			break;
+
+	} while(next_ring != current_ring);
+
+	igt_skip_on(next_ring == current_ring);
+
+	count_start = get_reset_count(fd, 0);
+	igt_assert(count_start >= 0);

tests/gem_reset_stats.c static void test_params(void) · line 1051

Quoted 10 lines
tests/gem_reset_stats.c +10 -0
+
+	igt_assert(inject_hang_ring(fd, 0, current_ring->exec, true));
+	while (--seconds) {
+		igt_assert(exec_valid_ring(fd, 0, next_ring->exec));
+
+		count_end = get_reset_count(fd, 0);
+		igt_assert(count_end >= 0);
+
+		if (count_end > count_start)
+			return;

s/return/break/ here? Otherwise lgtm, pls push with that fixed. -Daniel

Quoted 29 lines
tests/gem_reset_stats.c +13 -0
+
+		sleep(1);
+	}
+
+	igt_assert(count_end > count_start);
+
+	close(fd);
+}
+
 static bool gem_has_hw_contexts(int fd)
 {
 	struct local_drm_i915_gem_context_create create;
@@ -1159,5 +1198,9 @@ igt_main
 
 		igt_subtest_f("close-pending-fork-reverse-%s", name)
 			RUN_TEST(test_close_pending_fork(true));
+
+		igt_subtest_f("defer-hangcheck-%s", name)
+			RUN_TEST(defer_hangcheck(i));
+
 	}
 }
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx