[igt-dev] [PATCH i-g-t v3] runner: Show kernel state on detecting test timeout
Chris Wilson
chris at chris-wilson.co.uk
Fri Oct 11 13:22:37 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 | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/runner/executor.c b/runner/executor.c
index 1a00237fc..2bb828278 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -638,6 +638,25 @@ static const char *get_cmdline(pid_t pid, char *buf, ssize_t len)
return buf;
}
+static bool sysrq(char cmd)
+{
+ bool success = false;
+ int fd;
+
+ fd = open("/proc/sysrq-trigger", O_WRONLY);
+ if (fd >= 0) {
+ success = write(fd, &cmd, 1) == 1;
+ close(fd);
+ }
+
+ return success;
+}
+
+static void show_kernel_task_state(void)
+{
+ sysrq('t');
+}
+
/*
* Returns:
* =0 - Success
@@ -728,6 +747,8 @@ static int monitor_output(pid_t child,
switch (killed) {
case 0:
+ show_kernel_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