[igt-dev] [PATCH i-g-t] runner: Show kernel state on detecting test timeout
Chris Wilson
chris at chris-wilson.co.uk
Fri Oct 11 13:18:36 UTC 2019
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 at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at 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
More information about the igt-dev
mailing list