unwind: Add dump_stack test
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/kernel/dwarf_unwind/unwind.c b/kernel/dwarf_unwind/unwind.c
index b64e1a2..af64b7b 100644
--- a/kernel/dwarf_unwind/unwind.c
+++ b/kernel/dwarf_unwind/unwind.c
@@ -342,3 +342,45 @@
return ret;
}
+
+static ssize_t
+test_write(struct file *filp, const char __user *ubuf,
+ size_t cnt, loff_t *ppos)
+{
+ printk("Testing dwarf unwind from process context.\n");
+
+ if (dwarf_unwind_debug) {
+ printk("Dwarf unwind debug enabled: ");
+
+ if (dwarf_unwind_debug & DU_DEBUG_READ)
+ printk("read ");
+ if (dwarf_unwind_debug & DU_DEBUG_FRAMES)
+ printk("frames ");
+ if (dwarf_unwind_debug & DU_DEBUG_EH_FRAMES)
+ printk("eh-frames ");
+ if (dwarf_unwind_debug & DU_DEBUG_CFI)
+ printk("cfi ");
+ if (dwarf_unwind_debug & DU_DEBUG_EXPR)
+ printk("expr");
+
+ printk("\n");
+ }
+
+ dump_stack();
+ return cnt;
+}
+
+static const struct file_operations test_fops = {
+ .write = test_write,
+};
+
+static int __init unwind_init_test(void)
+{
+ if (!debugfs_create_file("unwind_test", 0644, NULL, NULL,
+ &test_fops))
+ return -ENOMEM;
+
+ return 0;
+}
+
+late_initcall(unwind_init_test);