summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-09-12 21:07:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-09-28 15:18:55 +0100
commite917e926823b801208c4cc1178ea9f7755a7fab1 (patch)
tree9652c6db073f35e9feb93ca3acd4f95497856ad9 /lib/igt_aux.c
parent2885b10f99b4beeb046e75af8b8488c229f629d3 (diff)
lib: Capture the error state on an unexpected hang
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@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index eb1f90f9..fa6594c3 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -394,7 +394,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");
@@ -428,8 +428,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);
@@ -461,7 +463,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)