[igt-dev] [PATCH i-g-t] i915/gem_ctx_ringsize: Manually control timeout

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 31 09:15:48 UTC 2020


Manually setup the signal handler for SIGARLM so that we can dump some
debug information for test failures.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_ctx_ringsize.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_ctx_ringsize.c b/tests/i915/gem_ctx_ringsize.c
index c8e661472..4530b242f 100644
--- a/tests/i915/gem_ctx_ringsize.c
+++ b/tests/i915/gem_ctx_ringsize.c
@@ -25,6 +25,7 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <math.h>
+#include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -214,6 +215,10 @@ static uint32_t batch_create(int i915)
 	return __batch_create(i915, 0);
 }
 
+static void sighandler(int sig)
+{
+}
+
 static unsigned int measure_inflight(int i915, unsigned int engine, int timeout)
 {
 	IGT_CORK_FENCE(cork);
@@ -230,15 +235,18 @@ static unsigned int measure_inflight(int i915, unsigned int engine, int timeout)
 	int err;
 
 	fcntl(i915, F_SETFL, fcntl(i915, F_GETFL) | O_NONBLOCK);
-	igt_set_timeout(timeout, "execbuf blocked!");
+	signal(SIGALRM, sighandler);
+	alarm(timeout);
 
 	gem_execbuf(i915, &execbuf);
 	for (count = 1; (err = __execbuf(i915, &execbuf)) == 0; count++)
 		;
+	igt_debugfs_dump(i915, "i915_engine_info");
 	igt_assert_eq(err, -EWOULDBLOCK);
 	close(execbuf.rsvd2);
 
-	igt_reset_timeout();
+	alarm(0);
+	signal(SIGALRM, SIG_DFL);
 	fcntl(i915, F_SETFL, fcntl(i915, F_GETFL) & ~O_NONBLOCK);
 
 	igt_cork_unplug(&cork);
-- 
2.28.0



More information about the igt-dev mailing list