1 From: Nicolas Pitre <nico@cam.org>
3 Signed-off-by: Nicolas Pitre <nico@marvell.com>
4 Tested-by: Lennert Buytenhek <buytenh@marvell.com>
5 Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
7 arch/arm/Kconfig | 4 ++++
8 arch/arm/kernel/stacktrace.c | 26 ++++++++++++++++++++++----
9 2 files changed, 26 insertions(+), 4 deletions(-)
11 --- a/arch/arm/Kconfig
12 +++ b/arch/arm/Kconfig
17 +config HAVE_LATENCYTOP_SUPPORT
21 config LOCKDEP_SUPPORT
24 --- a/arch/arm/kernel/stacktrace.c
25 +++ b/arch/arm/kernel/stacktrace.c
27 #ifdef CONFIG_STACKTRACE
28 struct stack_trace_data {
29 struct stack_trace *trace;
30 + unsigned int no_sched_functions;
36 struct stack_trace_data *data = d;
37 struct stack_trace *trace = data->trace;
38 + unsigned long addr = frame->lr;
40 + if (data->no_sched_functions && in_sched_functions(addr))
47 - trace->entries[trace->nr_entries++] = frame->lr;
48 + trace->entries[trace->nr_entries++] = addr;
50 return trace->nr_entries >= trace->max_entries;
53 -void save_stack_trace(struct stack_trace *trace)
54 +void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
56 struct stack_trace_data data;
57 unsigned long fp, base;
60 data.skip = trace->skip;
61 - base = (unsigned long)task_stack_page(current);
62 - asm("mov %0, fp" : "=r" (fp));
63 + base = (unsigned long)task_stack_page(tsk);
65 + if (tsk != current) {
66 + data.no_sched_functions = 1;
67 + fp = thread_saved_fp(tsk);
69 + data.no_sched_functions = 0;
70 + asm("mov %0, fp" : "=r" (fp));
73 walk_stackframe(fp, base, base + THREAD_SIZE, save_trace, &data);
74 + if (trace->nr_entries < trace->max_entries)
75 + trace->entries[trace->nr_entries++] = ULONG_MAX;
78 +void save_stack_trace(struct stack_trace *trace)
80 + save_stack_trace_tsk(current, trace);