]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arch: Make ARCH_STACKWALK independent of STACKTRACE
authorPeter Zijlstra <peterz@infradead.org>
Mon, 29 Nov 2021 14:28:41 +0000 (14:28 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 10 Dec 2021 14:06:03 +0000 (14:06 +0000)
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>
arch/arm64/kernel/stacktrace.c
arch/powerpc/kernel/Makefile
arch/riscv/kernel/stacktrace.c
arch/s390/kernel/Makefile
arch/x86/kernel/Makefile
include/linux/stacktrace.h

index 94f83cd44e507644f12ea774d94a7606a60eacb2..e6ba6b000564d26eb9d9b64b219f6663d4514a91 100644 (file)
@@ -221,8 +221,6 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)
        barrier();
 }
 
-#ifdef CONFIG_STACKTRACE
-
 noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
                              void *cookie, struct task_struct *task,
                              struct pt_regs *regs)
@@ -241,5 +239,3 @@ noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
 
        walk_stackframe(task, &frame, consume_entry, cookie);
 }
-
-#endif
index 5fa68c2ef1f81a8291b0a2ba4cff060a8b9f115e..b039877c743dc755e9eb0dc3d578db01f737e142 100644 (file)
@@ -47,7 +47,7 @@ obj-y                         := cputable.o syscalls.o \
                                   udbg.o misc.o io.o misc_$(BITS).o \
                                   of_platform.o prom_parse.o firmware.o \
                                   hw_breakpoint_constraints.o interrupt.o \
-                                  kdebugfs.o
+                                  kdebugfs.o stacktrace.o
 obj-y                          += ptrace/
 obj-$(CONFIG_PPC64)            += setup_64.o \
                                   paca.o nvram_64.o note.o
@@ -116,7 +116,6 @@ obj-$(CONFIG_OPTPROBES)             += optprobes.o optprobes_head.o
 obj-$(CONFIG_KPROBES_ON_FTRACE)        += kprobes-ftrace.o
 obj-$(CONFIG_UPROBES)          += uprobes.o
 obj-$(CONFIG_PPC_UDBG_16550)   += legacy_serial.o udbg_16550.o
-obj-$(CONFIG_STACKTRACE)       += stacktrace.o
 obj-$(CONFIG_SWIOTLB)          += dma-swiotlb.o
 obj-$(CONFIG_ARCH_HAS_DMA_SET_MASK) += dma-mask.o
 
index 0fcdc0233faca3df8d1c5237f7d2f347737c33d4..201ee206fb57d718e4a184fb93d1de53d90a8f4e 100644 (file)
@@ -139,12 +139,8 @@ unsigned long __get_wchan(struct task_struct *task)
        return pc;
 }
 
-#ifdef CONFIG_STACKTRACE
-
 noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
                     struct task_struct *task, struct pt_regs *regs)
 {
        walk_stackframe(task, regs, consume_entry, cookie);
 }
-
-#endif /* CONFIG_STACKTRACE */
index 80f500ffb55c3b0df903a960d35c20071e9ac34b..be8007f367aabe7764beb7d9894286ab498d47b1 100644 (file)
@@ -40,7 +40,7 @@ obj-y += sysinfo.o lgr.o os_info.o machine_kexec.o
 obj-y  += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
 obj-y  += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
 obj-y  += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o
-obj-y  += smp.o text_amode31.o
+obj-y  += smp.o text_amode31.o stacktrace.o
 
 extra-y                                += head64.o vmlinux.lds
 
@@ -55,7 +55,6 @@ compat-obj-$(CONFIG_AUDIT)    += compat_audit.o
 obj-$(CONFIG_COMPAT)           += compat_linux.o compat_signal.o
 obj-$(CONFIG_COMPAT)           += $(compat-obj-y)
 obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
-obj-$(CONFIG_STACKTRACE)       += stacktrace.o
 obj-$(CONFIG_KPROBES)          += kprobes.o
 obj-$(CONFIG_KPROBES)          += kprobes_insn_page.o
 obj-$(CONFIG_FUNCTION_TRACER)  += mcount.o ftrace.o
index 2ff3e600f4269c4239ee07996180ba34d97bc124..6aef9ee28a3940dbf6754cd990df7f61ee4e7798 100644 (file)
@@ -84,7 +84,7 @@ obj-$(CONFIG_IA32_EMULATION)  += tls.o
 obj-y                          += step.o
 obj-$(CONFIG_INTEL_TXT)                += tboot.o
 obj-$(CONFIG_ISA_DMA_API)      += i8237.o
-obj-$(CONFIG_STACKTRACE)       += stacktrace.o
+obj-y                          += stacktrace.o
 obj-y                          += cpu/
 obj-y                          += acpi/
 obj-y                          += reboot.o
index bef158815e83d6071cd186b6f5e8c4de5dfd88b1..97455880ac4145a212920bc25d427ba477589751 100644 (file)
@@ -8,22 +8,6 @@
 struct task_struct;
 struct pt_regs;
 
-#ifdef CONFIG_STACKTRACE
-void stack_trace_print(const unsigned long *trace, unsigned int nr_entries,
-                      int spaces);
-int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
-                       unsigned int nr_entries, int spaces);
-unsigned int stack_trace_save(unsigned long *store, unsigned int size,
-                             unsigned int skipnr);
-unsigned int stack_trace_save_tsk(struct task_struct *task,
-                                 unsigned long *store, unsigned int size,
-                                 unsigned int skipnr);
-unsigned int stack_trace_save_regs(struct pt_regs *regs, unsigned long *store,
-                                  unsigned int size, unsigned int skipnr);
-unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
-unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
-
-/* Internal interfaces. Do not use in generic code */
 #ifdef CONFIG_ARCH_STACKWALK
 
 /**
@@ -76,8 +60,25 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie,
 
 void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie,
                          const struct pt_regs *regs);
+#endif /* CONFIG_ARCH_STACKWALK */
 
-#else /* CONFIG_ARCH_STACKWALK */
+#ifdef CONFIG_STACKTRACE
+void stack_trace_print(const unsigned long *trace, unsigned int nr_entries,
+                      int spaces);
+int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
+                       unsigned int nr_entries, int spaces);
+unsigned int stack_trace_save(unsigned long *store, unsigned int size,
+                             unsigned int skipnr);
+unsigned int stack_trace_save_tsk(struct task_struct *task,
+                                 unsigned long *store, unsigned int size,
+                                 unsigned int skipnr);
+unsigned int stack_trace_save_regs(struct pt_regs *regs, unsigned long *store,
+                                  unsigned int size, unsigned int skipnr);
+unsigned int stack_trace_save_user(unsigned long *store, unsigned int size);
+unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
+
+#ifndef CONFIG_ARCH_STACKWALK
+/* Internal interfaces. Do not use in generic code */
 struct stack_trace {
        unsigned int nr_entries, max_entries;
        unsigned long *entries;