[Intel-gfx] [PATCH igt] lib: Capture the error state on an unexpected hang

Chris Wilson chris at chris-wilson.co.uk
Tue Sep 12 20:10:25 UTC 2017


Dump debugfs/i915_error_state to the debug channel if we detect an ERROR
uevent. This poses a few problems, not least that it is the auxiliary
process doing the dumping (so the output may be interleaved with the
test, but considering a hang occurred it is likely the test is blocked)
and the average error state is around 60k, which may prove unwieldy!

On the other hand, it may prove invaluable in debugging those impossible
to reproduce bugs.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_aux.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 65f832ab..ae076aaa 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -395,7 +395,7 @@ void igt_stop_shrink_helper(void)
 
 static struct igt_helper_process hang_detector;
 static void __attribute__((noreturn))
-hang_detector_process(pid_t pid, dev_t rdev)
+hang_detector_process(int fd, pid_t pid, dev_t rdev)
 {
 	struct udev_monitor *mon =
 		udev_monitor_new_from_netlink(udev_new(), "kernel");
@@ -429,8 +429,10 @@ hang_detector_process(pid_t pid, dev_t rdev)
 			const char *str;
 
 			str = udev_device_get_property_value(dev, "ERROR");
-			if (str && atoi(str) == 1)
+			if (str && atoi(str) == 1) {
+				igt_debugfs_dump(fd, "i915_error_state");
 				kill(pid, SIGIO);
+			}
 		}
 
 		udev_device_unref(dev);
@@ -462,7 +464,7 @@ void igt_fork_hang_detector(int fd)
 
 	signal(SIGIO, sig_abort);
 	igt_fork_helper(&hang_detector)
-		hang_detector_process(getppid(), st.st_rdev);
+		hang_detector_process(fd, getppid(), st.st_rdev);
 }
 
 void igt_stop_hang_detector(void)
-- 
2.14.1



More information about the Intel-gfx mailing list