summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-05-03 21:53:41 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-05-06 13:10:23 +0100
commit91b5a3ef5516b29584ea4567b0f5ffa18219b29f (patch)
tree126e45f907e82f1ab35e8baf392b8688926ab4cd /lib/igt_aux.c
parentf772d9a910130b3aec8efa4f09ed723618fae656 (diff)
lib: Show the kernel stack when reporting a GPU hang
In a few tests (like gem_exec_await, gem_exec_schedule) we use the GPU hang to break a deadlock hit during test setup. In these case we would like to see where in kernel the process is stuck (if at all). References: https://bugs.freedesktop.org/show_bug.cgi?id=105900 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index aabf6e50..acafb713 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -426,6 +426,24 @@ void igt_stop_shrink_helper(void)
igt_stop_helper(&shrink_helper);
}
+static void show_kernel_stack(pid_t pid)
+{
+ char buf[80], *str;
+ int dir;
+
+ snprintf(buf, sizeof(buf), "/proc/%d", pid);
+ dir = open(buf, O_RDONLY);
+ if (dir < 0)
+ return;
+
+ str = igt_sysfs_get(dir, "stack");
+ if (str) {
+ igt_debug("Kernel stack for pid %d:\n%s\n", pid, str);
+ free(str);
+ }
+
+ close(dir);
+}
static struct igt_helper_process hang_detector;
static void __attribute__((noreturn))
@@ -465,6 +483,7 @@ hang_detector_process(int fd, pid_t pid, dev_t rdev)
str = udev_device_get_property_value(dev, "ERROR");
if (str && atoi(str) == 1) {
igt_debugfs_dump(fd, "i915_error_state");
+ show_kernel_stack(pid);
kill(pid, SIGIO);
}
}