linux_dsm_epyc7002/arch/unicore32/kernel
Tejun Heo 196779b9b4 dump_stack: consolidate dump_stack() implementations and unify their behaviors
Both dump_stack() and show_stack() are currently implemented by each
architecture.  show_stack(NULL, NULL) dumps the backtrace for the
current task as does dump_stack().  On some archs, dump_stack() prints
extra information - pid, utsname and so on - in addition to the
backtrace while the two are identical on other archs.

The usages in arch-independent code of the two functions indicate
show_stack(NULL, NULL) should print out bare backtrace while
dump_stack() is used for debugging purposes when something went wrong,
so it does make sense to print additional information on the task which
triggered dump_stack().

There's no reason to require archs to implement two separate but mostly
identical functions.  It leads to unnecessary subtle information.

This patch expands the dummy fallback dump_stack() implementation in
lib/dump_stack.c such that it prints out debug information (taken from
x86) and invokes show_stack(NULL, NULL) and drops arch-specific
dump_stack() implementations in all archs except blackfin.  Blackfin's
dump_stack() does something wonky that I don't understand.

Debug information can be printed separately by calling
dump_stack_print_info() so that arch-specific dump_stack()
implementation can still emit the same debug information.  This is used
in blackfin.

This patch brings the following behavior changes.

* On some archs, an extra level in backtrace for show_stack() could be
  printed.  This is because the top frame was determined in
  dump_stack() on those archs while generic dump_stack() can't do that
  reliably.  It can be compensated by inlining dump_stack() but not
  sure whether that'd be necessary.

* Most archs didn't use to print debug info on dump_stack().  They do
  now.

An example WARN dump follows.

 WARNING: at kernel/workqueue.c:4841 init_workqueues+0x35/0x505()
 Hardware name: empty
 Modules linked in:
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #9
  0000000000000009 ffff88007c861e08 ffffffff81c614dc ffff88007c861e48
  ffffffff8108f50f ffffffff82228240 0000000000000040 ffffffff8234a03c
  0000000000000000 0000000000000000 0000000000000000 ffff88007c861e58
 Call Trace:
  [<ffffffff81c614dc>] dump_stack+0x19/0x1b
  [<ffffffff8108f50f>] warn_slowpath_common+0x7f/0xc0
  [<ffffffff8108f56a>] warn_slowpath_null+0x1a/0x20
  [<ffffffff8234a071>] init_workqueues+0x35/0x505
  ...

v2: CPU number added to the generic debug info as requested by s390
    folks and dropped the s390 specific dump_stack().  This loses %ksp
    from the debug message which the maintainers think isn't important
    enough to keep the s390-specific dump_stack() implementation.

    dump_stack_print_info() is moved to kernel/printk.c from
    lib/dump_stack.c.  Because linkage is per objecct file,
    dump_stack_print_info() living in the same lib file as generic
    dump_stack() means that archs which implement custom dump_stack()
    - at this point, only blackfin - can't use dump_stack_print_info()
    as that will bring in the generic version of dump_stack() too.  v1
    The v1 patch broke build on blackfin due to this issue.  The build
    breakage was reported by Fengguang Wu.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>	[s390 bits]
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Richard Kuo <rkuo@codeaurora.org>		[hexagon bits]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-30 17:04:02 -07:00
..
asm-offsets.c unicore32 core architecture: generic elf and ksyms stuff 2011-03-17 09:19:05 +08:00
clock.c unicore32 io: redefine __REG(x) and re-use readl/writel funcs 2011-03-17 09:19:19 +08:00
cpu-ucv2.c unicore32 additional architecture files: pm related files 2011-03-17 09:19:11 +08:00
debug-macro.S unicore32 additional architecture files: low-level lib: ocd debug 2011-03-17 09:19:12 +08:00
debug.S unicore32 additional architecture files: low-level lib: ocd debug 2011-03-17 09:19:12 +08:00
dma.c Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
early_printk.c early_printk: consolidate random copies of identical code 2013-04-29 18:28:13 -07:00
elf.c unicore32 core architecture: generic elf and ksyms stuff 2011-03-17 09:19:05 +08:00
entry.S unicore32: switch to generic sigaltstack 2013-02-03 18:16:23 -05:00
fpu-ucf64.c unicore32 additional architecture files: float point handling 2011-03-17 09:19:11 +08:00
gpio.c unicore32 io: redefine __REG(x) and re-use readl/writel funcs 2011-03-17 09:19:19 +08:00
head.S Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
hibernate_asm.S unicore32 additional architecture files: pm related files 2011-03-17 09:19:11 +08:00
hibernate.c Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
irq.c Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
ksyms.c Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
ksyms.h unicore32 core architecture: generic elf and ksyms stuff 2011-03-17 09:19:05 +08:00
Makefile pwm: Move PUV3 PWM driver to PWM framework 2012-10-05 20:56:41 +02:00
module.c modules: don't hand 0 to vmalloc. 2012-12-14 13:06:43 +10:30
pci.c ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
pm.c unicore32 additional architecture files: pm related files 2011-03-17 09:19:11 +08:00
process.c unicore: Use generic idle loop 2013-04-08 17:39:29 +02:00
ptrace.c unicore32 additional architecture files: ptrace handling 2011-03-17 09:19:12 +08:00
puv3-core.c driver-core: remove sysdev.h usage. 2011-12-21 16:26:03 -08:00
puv3-nb0916.c unicore32: Remove IRQF_DISABLED 2012-01-10 10:29:41 +08:00
setup.c unicore32: standardize /proc/iomem "Kernel code" name 2012-01-10 10:29:40 +08:00
setup.h UniCore32-bugfix: Remove definitions in asm/bug.h to solve difference between native and cross compiler 2012-11-09 17:30:09 +08:00
signal.c unicore32: switch to generic sigaltstack 2013-02-03 18:16:23 -05:00
sleep.S unicore32: modify io_p2v and io_v2p macros, and adjust PKUNITY_mmio_BASEs 2011-03-17 09:19:21 +08:00
stacktrace.c unicore32 core architecture: process/thread related codes 2011-03-17 09:19:07 +08:00
sys.c unicore32: switch to generic clone(2) 2012-11-28 23:43:40 -05:00
time.c unicore32: Remove IRQF_DISABLED 2012-01-10 10:29:41 +08:00
traps.c dump_stack: consolidate dump_stack() implementations and unify their behaviors 2013-04-30 17:04:02 -07:00
vmlinux.lds.S unicore32: change PERCPU to PERCPU_SECTION 2011-06-09 16:27:46 +08:00