2 * Provide a default dump_stack() function for architectures
3 * which don't implement their own.
6 #include <linux/kernel.h>
7 #include <linux/export.h>
8 #include <linux/sched.h>
10 #include <linux/atomic.h>
12 static void __dump_stack(void)
14 dump_stack_print_info(KERN_DEFAULT);
15 show_stack(NULL, NULL);
19 * dump_stack - dump the current task information and its stack trace
21 * Architectures can override this implementation by implementing its own.
24 static atomic_t dump_lock = ATOMIC_INIT(-1);
26 asmlinkage __visible void dump_stack(void)
33 * Permit this cpu to perform nested stack dumps while serialising
39 cpu = smp_processor_id();
40 old = atomic_cmpxchg(&dump_lock, -1, cpu);
43 } else if (old == cpu) {
53 atomic_set(&dump_lock, -1);
58 asmlinkage __visible void dump_stack(void)
63 EXPORT_SYMBOL(dump_stack);