diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-11-08 11:43:25 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-11-09 22:34:14 +0000 |
commit | 7d75119b7f23fb49af52463da9bcd62e64fe6a6f (patch) | |
tree | 7aed842c502fdc25df6ebfe801fad3ebcab18faf /lib/igt_core.c | |
parent | e6c4968fa0dfd2df5dd81cdec9fd785250f30899 (diff) |
lib: Always enable ftrace-dump-on-oops
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@chris-wilson.co.uk>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r-- | lib/igt_core.c | 23 |
1 files changed, 23 insertions, 0 deletions
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 */ |