public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] runner: Show kernel state on detecting test timeout
@ 2019-10-11 13:18 Chris Wilson
  2019-10-11 13:20 ` [igt-dev] [PATCH i-g-t v2] " Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Chris Wilson @ 2019-10-11 13:18 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

When our watchdog expires and we declare the test has timed out, we send
it a signal to terminate. The test will produce a backtrace upon receipt
of that signal, but often times (especially as we do test and debug the
kernel), the test is hung inside the kernel. So we need the kernel state
to see where the live/deadlock is occuring. Enter sysrq-t to show the
backtraces of all processes (as the one we are searching for may be
sleeping).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala@intel.com>
---
 runner/executor.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/runner/executor.c b/runner/executor.c
index 1a00237fc..cd3d3a7be 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -638,6 +638,14 @@ static const char *get_cmdline(pid_t pid, char *buf, ssize_t len)
 	return buf;
 }
 
+static void sysrq(char cmd)
+{
+	int fd = open("/proc/sysrq-trigger", O_WRONLY);
+
+	igt_ignore_warn(write(fd, cmd, 1));
+	close(fd);
+}
+
 /*
  * Returns:
  *  =0 - Success
@@ -728,6 +736,8 @@ static int monitor_output(pid_t child,
 
 			switch (killed) {
 			case 0:
+				sysrq('t'); /* show task state */
+
 				if (settings->log_level >= LOG_LEVEL_NORMAL) {
 					outf("Timeout. Killing the current test with SIGQUIT.\n");
 					fflush(stdout);
-- 
2.23.0

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

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

end of thread, other threads:[~2019-10-14 12:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-11 13:18 [igt-dev] [PATCH i-g-t] runner: Show kernel state on detecting test timeout Chris Wilson
2019-10-11 13:20 ` [igt-dev] [PATCH i-g-t v2] " Chris Wilson
2019-10-11 13:22 ` [igt-dev] [PATCH i-g-t v3] " Chris Wilson
2019-10-14  6:58   ` Petri Latvala
2019-10-14  7:12     ` Chris Wilson
2019-10-14 12:53       ` Petri Latvala
2019-10-11 15:19 ` [igt-dev] ✓ Fi.CI.BAT: success for runner: Show kernel state on detecting test timeout (rev3) Patchwork
2019-10-11 23:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox