Skip to content

Commit ead6122

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: stacktrace: move dump functions to end of file
For historical reasons, the backtrace dumping functions are placed in the middle of stacktrace.c, despite using functions defined later. For clarity, and to make subsequent refactoring easier, move the dumping functions to the end of stacktrace.c There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Reviewed-by: Kalesh Singh <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Madhavan T. Venkataraman <[email protected]> Cc: Mark Brown <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 9e09d44 commit ead6122

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

arch/arm64/kernel/stacktrace.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -140,39 +140,6 @@ static void notrace unwind(struct unwind_state *state,
140140
}
141141
NOKPROBE_SYMBOL(unwind);
142142

143-
static bool dump_backtrace_entry(void *arg, unsigned long where)
144-
{
145-
char *loglvl = arg;
146-
printk("%s %pSb\n", loglvl, (void *)where);
147-
return true;
148-
}
149-
150-
void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
151-
const char *loglvl)
152-
{
153-
pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
154-
155-
if (regs && user_mode(regs))
156-
return;
157-
158-
if (!tsk)
159-
tsk = current;
160-
161-
if (!try_get_task_stack(tsk))
162-
return;
163-
164-
printk("%sCall trace:\n", loglvl);
165-
arch_stack_walk(dump_backtrace_entry, (void *)loglvl, tsk, regs);
166-
167-
put_task_stack(tsk);
168-
}
169-
170-
void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)
171-
{
172-
dump_backtrace(NULL, tsk, loglvl);
173-
barrier();
174-
}
175-
176143
/*
177144
* Per-cpu stacks are only accessible when unwinding the current task in a
178145
* non-preemptible context.
@@ -237,3 +204,36 @@ noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry,
237204

238205
unwind(&state, consume_entry, cookie);
239206
}
207+
208+
static bool dump_backtrace_entry(void *arg, unsigned long where)
209+
{
210+
char *loglvl = arg;
211+
printk("%s %pSb\n", loglvl, (void *)where);
212+
return true;
213+
}
214+
215+
void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
216+
const char *loglvl)
217+
{
218+
pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
219+
220+
if (regs && user_mode(regs))
221+
return;
222+
223+
if (!tsk)
224+
tsk = current;
225+
226+
if (!try_get_task_stack(tsk))
227+
return;
228+
229+
printk("%sCall trace:\n", loglvl);
230+
arch_stack_walk(dump_backtrace_entry, (void *)loglvl, tsk, regs);
231+
232+
put_task_stack(tsk);
233+
}
234+
235+
void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)
236+
{
237+
dump_backtrace(NULL, tsk, loglvl);
238+
barrier();
239+
}

0 commit comments

Comments
 (0)