[PATCH i-g-t] forgetful-error

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 5 01:11:49 UTC 2021


---
 tests/i915/gem_exec_fence.c | 63 +++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index b7b3f8e3f..937c001cc 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -391,6 +391,61 @@ static void test_fence_await(int fd, const struct intel_execution_engine2 *e,
 	gem_close(fd, scratch);
 }
 
+static void
+test_forgetful_error(int i915, const struct intel_execution_engine2 *e)
+{
+	igt_spin_t *hang, *spin;
+
+	/*
+	 * Use a hang to inject an error and see it forwards via the copy onto
+	 * the object. But once observed (and we idle) that error is then
+	 * forgotten.
+	 */
+
+	igt_require(igt_params_set(i915, "reset", "%u", -1));
+	igt_require(gem_engine_property_printf(i915, e->name,
+					       "preempt_timeout_ms", "%d", 50));
+
+	hang = igt_spin_new(i915,
+			    .engine = e->flags,
+			    .flags = (IGT_SPIN_FENCE_OUT |
+				      IGT_SPIN_NO_PREEMPTION |
+				      IGT_SPIN_POLL_RUN));
+
+	spin = igt_spin_new(i915,
+			    .engine = e->flags,
+			    .dependency = hang->poll_handle,
+			    .flags = IGT_SPIN_FENCE_OUT);
+	igt_spin_end(spin);
+
+	igt_assert_eq(sync_fence_wait(hang->out_fence, 0), -ETIME);
+	igt_spin_busywait_until_started(hang);
+
+	igt_require(gem_engine_property_printf(i915, e->name,
+					       "heartbeat_interval_ms", "%d", 50));
+
+	/* First check the error is propagated via the object dependency */
+	igt_assert_eq(sync_fence_wait(spin->out_fence, -1), 0);
+	igt_assert_eq(sync_fence_status(hang->out_fence), -EIO);
+	igt_assert_eq(sync_fence_status(spin->out_fence), -EIO);
+	igt_spin_free(i915, spin);
+
+	/* Now check that a fresh request using the object forgets the error */
+	spin = igt_spin_new(i915,
+			    .engine = e->flags,
+			    .dependency = hang->poll_handle,
+			    .flags = IGT_SPIN_FENCE_OUT);
+	igt_spin_end(spin);
+
+	/* This time the operation should complete successfully */
+	igt_assert_eq(sync_fence_wait(spin->out_fence, -1), 0);
+	igt_assert_eq(sync_fence_status(spin->out_fence), 1);
+	igt_spin_free(i915, spin);
+
+	igt_spin_free(i915, hang);
+	igt_require_gem(i915);
+}
+
 static uint32_t timeslicing_batches(int i915, uint32_t *offset)
 {
         uint32_t handle = gem_create(i915, 4096);
@@ -3092,6 +3147,14 @@ igt_main
 						test_fence_await(i915, e, NONBLOCK | HANG);
 				}
 			}
+
+			igt_subtest_with_dynamic("forgetful-error") {
+				__for_each_physical_engine(i915, e) {
+					igt_dynamic_f("%s", e->name)
+						test_forgetful_error(i915, e);
+				}
+			}
+
 			igt_fixture {
 				igt_disallow_hang(i915, hang);
 			}
-- 
2.30.1



More information about the Intel-gfx-trybot mailing list