]> git.ipfire.org Git - thirdparty/linux.git/blob - arch/csky/kernel/dumpstack.c
io_uring: reset -EBUSY error when io sq thread is waken up
[thirdparty/linux.git] / arch / csky / kernel / dumpstack.c
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3
4 #include <linux/ptrace.h>
5
6 int kstack_depth_to_print = 48;
7
8 void show_trace(unsigned long *stack)
9 {
10 unsigned long *stack_end;
11 unsigned long *stack_start;
12 unsigned long *fp;
13 unsigned long addr;
14
15 addr = (unsigned long) stack & THREAD_MASK;
16 stack_start = (unsigned long *) addr;
17 stack_end = (unsigned long *) (addr + THREAD_SIZE);
18
19 fp = stack;
20 pr_info("\nCall Trace:");
21
22 while (fp > stack_start && fp < stack_end) {
23 #ifdef CONFIG_STACKTRACE
24 addr = fp[1];
25 fp = (unsigned long *) fp[0];
26 #else
27 addr = *fp++;
28 #endif
29 if (__kernel_text_address(addr))
30 pr_cont("\n[<%08lx>] %pS", addr, (void *)addr);
31 }
32 pr_cont("\n");
33 }
34
35 void show_stack(struct task_struct *task, unsigned long *stack)
36 {
37 if (!stack) {
38 if (task)
39 stack = (unsigned long *)thread_saved_fp(task);
40 else
41 #ifdef CONFIG_STACKTRACE
42 asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
43 #else
44 stack = (unsigned long *)&stack;
45 #endif
46 }
47
48 show_trace(stack);
49 }