[Intel-gfx] [PATCH igt] lib: Always enable ftrace-dump-on-oops
Chris Wilson
chris at chris-wilson.co.uk
Wed Nov 8 12:10:57 UTC 2017
Some debugging information is too voluminous to enable by default, yet
may be invaluable when it comes to post-mortem debugging. trace_printk()
provides the facility for the trace ringbuffer to be dumped on oops,
this way we can cheaply spam the debug log and only present it in case
of emergency.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/igt_core.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 538a4472..ba4622d6 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -561,6 +561,28 @@ static void low_mem_killer_disable(bool disable)
chmod(adj_fname, buf.st_mode);
}
+/*
+ * If the test takes out the machine, in addition to the usual dmesg
+ * spam, the kernel may also emit a "death rattle" -- extra debug
+ * information that is overkill for normal successful tests, but
+ * vital for post-mortem analysis.
+ */
+static void ftrace_dump_on_oops(bool enable)
+{
+ int fd;
+
+ fd = open("/proc/sys/kernel/ftrace_dump_on_oops", O_WRONLY);
+ if (fd < 0)
+ return;
+
+ /*
+ * If we fail, we do not get the death rattle we wish, but we
+ * still want to run the tests anyway.
+ */
+ igt_ignore_warn(write(fd, enable ? "1\n" : "0\n", 2));
+ close(fd);
+}
+
bool igt_exit_called;
static void common_exit_handler(int sig)
{
@@ -858,6 +880,7 @@ out:
sync();
oom_adjust_for_doom();
low_mem_killer_disable(true);
+ ftrace_dump_on_oops(true);
}
/* install exit handler, to ensure we clean up */
--
2.15.0
More information about the Intel-gfx
mailing list