Skip to content

Commit 1614b2b

Browse files
Peter Zijlstractmarinas
authored andcommitted
arch: Make ARCH_STACKWALK independent of STACKTRACE
Make arch_stack_walk() available for ARCH_STACKWALK architectures without it being entangled in STACKTRACE. Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Peter Zijlstra (Intel) <[email protected]> [Mark: rebase, drop unnecessary arm change] Signed-off-by: Mark Rutland <[email protected]> Cc: Albert Ou <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent d58071a commit 1614b2b

File tree

6 files changed

+21
-30
lines changed

6 files changed

+21
-30
lines changed

arch/arm64/kernel/stacktrace.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)
221221
barrier();
222222
}
223223

224-
#ifdef CONFIG_STACKTRACE
225-
226224
noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
227225
void *cookie, struct task_struct *task,
228226
struct pt_regs *regs)
@@ -241,5 +239,3 @@ noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
241239

242240
walk_stackframe(task, &frame, consume_entry, cookie);
243241
}
244-
245-
#endif

arch/powerpc/kernel/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ obj-y := cputable.o syscalls.o \
4747
udbg.o misc.o io.o misc_$(BITS).o \
4848
of_platform.o prom_parse.o firmware.o \
4949
hw_breakpoint_constraints.o interrupt.o \
50-
kdebugfs.o
50+
kdebugfs.o stacktrace.o
5151
obj-y += ptrace/
5252
obj-$(CONFIG_PPC64) += setup_64.o \
5353
paca.o nvram_64.o note.o
@@ -116,7 +116,6 @@ obj-$(CONFIG_OPTPROBES) += optprobes.o optprobes_head.o
116116
obj-$(CONFIG_KPROBES_ON_FTRACE) += kprobes-ftrace.o
117117
obj-$(CONFIG_UPROBES) += uprobes.o
118118
obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
119-
obj-$(CONFIG_STACKTRACE) += stacktrace.o
120119
obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o
121120
obj-$(CONFIG_ARCH_HAS_DMA_SET_MASK) += dma-mask.o
122121

arch/riscv/kernel/stacktrace.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,8 @@ unsigned long __get_wchan(struct task_struct *task)
139139
return pc;
140140
}
141141

142-
#ifdef CONFIG_STACKTRACE
143-
144142
noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
145143
struct task_struct *task, struct pt_regs *regs)
146144
{
147145
walk_stackframe(task, regs, consume_entry, cookie);
148146
}
149-
150-
#endif /* CONFIG_STACKTRACE */

arch/s390/kernel/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ obj-y += sysinfo.o lgr.o os_info.o machine_kexec.o
4040
obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
4141
obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
4242
obj-y += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o
43-
obj-y += smp.o text_amode31.o
43+
obj-y += smp.o text_amode31.o stacktrace.o
4444

4545
extra-y += head64.o vmlinux.lds
4646

@@ -55,7 +55,6 @@ compat-obj-$(CONFIG_AUDIT) += compat_audit.o
5555
obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o
5656
obj-$(CONFIG_COMPAT) += $(compat-obj-y)
5757
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
58-
obj-$(CONFIG_STACKTRACE) += stacktrace.o
5958
obj-$(CONFIG_KPROBES) += kprobes.o
6059
obj-$(CONFIG_KPROBES) += kprobes_insn_page.o
6160
obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o

arch/x86/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ obj-$(CONFIG_IA32_EMULATION) += tls.o
8484
obj-y += step.o
8585
obj-$(CONFIG_INTEL_TXT) += tboot.o
8686
obj-$(CONFIG_ISA_DMA_API) += i8237.o
87-
obj-$(CONFIG_STACKTRACE) += stacktrace.o
87+
obj-y += stacktrace.o
8888
obj-y += cpu/
8989
obj-y += acpi/
9090
obj-y += reboot.o

include/linux/stacktrace.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@
88
struct task_struct;
99
struct pt_regs;
1010

11-
#ifdef CONFIG_STACKTRACE
12-
void stack_trace_print(const unsigned long *trace, unsigned int nr_entries,
13-
int spaces);
14-
int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
15-
unsigned int nr_entries, int spaces);
16-
unsigned int stack_trace_save(unsigned long *store, unsigned int size,
17-
unsigned int skipnr);
18-
unsigned int stack_trace_save_tsk(struct task_struct *task,
19-
unsigned long *store, unsigned int size,
20-
unsigned int skipnr);
21-
unsigned int stack_trace_save_regs(struct pt_regs *regs, unsigned long *store,
22-
unsigned int size, unsigned int skipnr);
23-
unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
24-
unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
25-
26-
/* Internal interfaces. Do not use in generic code */
2711
#ifdef CONFIG_ARCH_STACKWALK
2812

2913
/**
@@ -76,8 +60,25 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie,
7660

7761
void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
7862
const struct pt_regs *regs);
63+
#endif /* CONFIG_ARCH_STACKWALK */
7964

80-
#else /* CONFIG_ARCH_STACKWALK */
65+
#ifdef CONFIG_STACKTRACE
66+
void stack_trace_print(const unsigned long *trace, unsigned int nr_entries,
67+
int spaces);
68+
int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
69+
unsigned int nr_entries, int spaces);
70+
unsigned int stack_trace_save(unsigned long *store, unsigned int size,
71+
unsigned int skipnr);
72+
unsigned int stack_trace_save_tsk(struct task_struct *task,
73+
unsigned long *store, unsigned int size,
74+
unsigned int skipnr);
75+
unsigned int stack_trace_save_regs(struct pt_regs *regs, unsigned long *store,
76+
unsigned int size, unsigned int skipnr);
77+
unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
78+
unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
79+
80+
#ifndef CONFIG_ARCH_STACKWALK
81+
/* Internal interfaces. Do not use in generic code */
8182
struct stack_trace {
8283
unsigned int nr_entries, max_entries;
8384
unsigned long *entries;

0 commit comments

Comments
 (0)