Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/20211022152104.356586621@infradead.org/
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Mark: rebase, drop unnecessary arm change]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20211129142849.3056714-2-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Peter Zijlstra and committed by
Catalin Marinas
1614b2b1 d58071a8

+21 -30
-4
arch/arm64/kernel/stacktrace.c
··· 221 221 barrier(); 222 222 } 223 223 224 - #ifdef CONFIG_STACKTRACE 225 - 226 224 noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry, 227 225 void *cookie, struct task_struct *task, 228 226 struct pt_regs *regs) ··· 239 241 240 242 walk_stackframe(task, &frame, consume_entry, cookie); 241 243 } 242 - 243 - #endif
+1 -2
arch/powerpc/kernel/Makefile
··· 47 47 udbg.o misc.o io.o misc_$(BITS).o \ 48 48 of_platform.o prom_parse.o firmware.o \ 49 49 hw_breakpoint_constraints.o interrupt.o \ 50 - kdebugfs.o 50 + kdebugfs.o stacktrace.o 51 51 obj-y += ptrace/ 52 52 obj-$(CONFIG_PPC64) += setup_64.o \ 53 53 paca.o nvram_64.o note.o ··· 116 116 obj-$(CONFIG_KPROBES_ON_FTRACE) += kprobes-ftrace.o 117 117 obj-$(CONFIG_UPROBES) += uprobes.o 118 118 obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 119 - obj-$(CONFIG_STACKTRACE) += stacktrace.o 120 119 obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o 121 120 obj-$(CONFIG_ARCH_HAS_DMA_SET_MASK) += dma-mask.o 122 121
-4
arch/riscv/kernel/stacktrace.c
··· 139 139 return pc; 140 140 } 141 141 142 - #ifdef CONFIG_STACKTRACE 143 - 144 142 noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, 145 143 struct task_struct *task, struct pt_regs *regs) 146 144 { 147 145 walk_stackframe(task, regs, consume_entry, cookie); 148 146 } 149 - 150 - #endif /* CONFIG_STACKTRACE */
+1 -2
arch/s390/kernel/Makefile
··· 40 40 obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o 41 41 obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o 42 42 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 44 44 45 45 extra-y += head64.o vmlinux.lds 46 46 ··· 55 55 obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o 56 56 obj-$(CONFIG_COMPAT) += $(compat-obj-y) 57 57 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 58 - obj-$(CONFIG_STACKTRACE) += stacktrace.o 59 58 obj-$(CONFIG_KPROBES) += kprobes.o 60 59 obj-$(CONFIG_KPROBES) += kprobes_insn_page.o 61 60 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
+1 -1
arch/x86/kernel/Makefile
··· 84 84 obj-y += step.o 85 85 obj-$(CONFIG_INTEL_TXT) += tboot.o 86 86 obj-$(CONFIG_ISA_DMA_API) += i8237.o 87 - obj-$(CONFIG_STACKTRACE) += stacktrace.o 87 + obj-y += stacktrace.o 88 88 obj-y += cpu/ 89 89 obj-y += acpi/ 90 90 obj-y += reboot.o
+18 -17
include/linux/stacktrace.h
··· 8 8 struct task_struct; 9 9 struct pt_regs; 10 10 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 */ 27 11 #ifdef CONFIG_ARCH_STACKWALK 28 12 29 13 /** ··· 60 76 61 77 void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, 62 78 const struct pt_regs *regs); 79 + #endif /* CONFIG_ARCH_STACKWALK */ 63 80 64 - #else /* CONFIG_ARCH_STACKWALK */ 81 + #ifdef CONFIG_STACKTRACE 82 + void stack_trace_print(const unsigned long *trace, unsigned int nr_entries, 83 + int spaces); 84 + int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries, 85 + unsigned int nr_entries, int spaces); 86 + unsigned int stack_trace_save(unsigned long *store, unsigned int size, 87 + unsigned int skipnr); 88 + unsigned int stack_trace_save_tsk(struct task_struct *task, 89 + unsigned long *store, unsigned int size, 90 + unsigned int skipnr); 91 + unsigned int stack_trace_save_regs(struct pt_regs *regs, unsigned long *store, 92 + unsigned int size, unsigned int skipnr); 93 + unsigned int stack_trace_save_user(unsigned long *store, unsigned int size); 94 + unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries); 95 + 96 + #ifndef CONFIG_ARCH_STACKWALK 97 + /* Internal interfaces. Do not use in generic code */ 65 98 struct stack_trace { 66 99 unsigned int nr_entries, max_entries; 67 100 unsigned long *entries;