summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-10-11 14:00:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-10-14 13:59:11 +0100
commit991ce4eede1c52f76378aebf162a13c20d6f6293 (patch)
tree15f6e00aa4142d0bd148a07ef0035d031ed79fd7 /runner
parentb7f07ac861e5cb8e015b0368cc0ee029de885326 (diff)
runner: Show kernel state on detecting test timeout
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>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/runner/executor.c b/runner/executor.c
index 1a00237f..2bb82827 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);