All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib: Show the kernel stack when reporting a GPU hang
@ 2018-05-03 20:55 Chris Wilson
  2018-05-03 21:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2018-05-03 20:55 UTC (permalink / raw)
  To: igt-dev

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>
---
 lib/igt_aux.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 64b952961..c192c09cb 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -427,6 +427,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))
@@ -466,6 +484,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);
 			}
 		}
-- 
2.17.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-04 20:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 20:55 [igt-dev] [PATCH i-g-t] lib: Show the kernel stack when reporting a GPU hang Chris Wilson
2018-05-03 21:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-05-04  1:36 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-05-04 18:19 ` [igt-dev] [PATCH i-g-t] " Antonio Argenziano
2018-05-04 20:19   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.