]> git.ipfire.org Git - thirdparty/linux.git/blame - 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
CommitLineData
2ce36bfa
GR
1// SPDX-License-Identifier: GPL-2.0
2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3
4#include <linux/ptrace.h>
5
6int kstack_depth_to_print = 48;
7
8void show_trace(unsigned long *stack)
9{
8f4f1639
GR
10 unsigned long *stack_end;
11 unsigned long *stack_start;
12 unsigned long *fp;
2ce36bfa 13 unsigned long addr;
2ce36bfa 14
8f4f1639
GR
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++;
2ce36bfa 28#endif
8f4f1639
GR
29 if (__kernel_text_address(addr))
30 pr_cont("\n[<%08lx>] %pS", addr, (void *)addr);
2ce36bfa
GR
31 }
32 pr_cont("\n");
33}
34
35void show_stack(struct task_struct *task, unsigned long *stack)
36{
2ce36bfa
GR
37 if (!stack) {
38 if (task)
8f4f1639 39 stack = (unsigned long *)thread_saved_fp(task);
2ce36bfa 40 else
131aee8b
GR
41#ifdef CONFIG_STACKTRACE
42 asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
43#else
2ce36bfa 44 stack = (unsigned long *)&stack;
131aee8b 45#endif
2ce36bfa 46 }
2ce36bfa 47
2ce36bfa
GR
48 show_trace(stack);
49}