alistair23-linux/arch/m68k/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
..
.gitignore m68k: Add vmlinux.lds to .gitignore 2009-01-12 20:56:32 +01:00
asm-offsets.c m68k: remove thread_info struct from thread struct 2011-12-24 21:47:56 +10:00
dma.c m68k: add support for DMA_BIDIRECTIONAL in dma support functions 2012-07-17 15:49:40 +10:00
entry.S m68k: sanitize copy_thread(), fork/vfork/clone wrappers, switch to generic fork/vfork 2012-11-28 22:44:46 -05:00
head.S m68k/mac: early console 2011-12-10 19:52:45 +01:00
ints.c Disintegrate asm/system.h for M68K 2012-03-28 18:30:02 +01:00
irq.c Disintegrate asm/system.h for M68K 2012-03-28 18:30:02 +01:00
m68k_ksyms.c m68k: handle presence of 64bit mul/div instructions cleanly 2011-12-24 21:47:57 +10:00
Makefile m68k: Sort out !CONFIG_MMU_SUN3 vs. CONFIG_HAS_DMA 2013-02-09 14:23:36 +01:00
module.c module.c: spelling s/postition/position/g 2012-07-20 10:38:35 +02:00
module.lds
pcibios.c ARCH: drivers remove __dev* attributes. 2013-01-03 15:57:13 -08:00
process.c m68k: Use generic idle loop 2013-04-08 17:39:26 +02:00
ptrace.c m68k: make syscall_trace_enter/leave exist for non-MMU classic m68k types 2012-06-12 11:58:29 +10:00
setup.c m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
setup_mm.c m68k/atari: ROM port ISA adapter support 2013-04-16 21:08:11 +02:00
setup_no.c m68knommu: add CPU_NAME for 68000 2013-03-04 11:08:29 +10:00
signal.c m68k: switch to generic old sigaction() 2013-02-03 18:16:00 -05:00
sun3-head.S m68k: arch/m68k/kernel/sun3-head.S needs <linux/init.h> 2009-04-28 16:07:18 -07:00
sys_m68k.c m68k: switch to generic sys_execve()/kernel_execve() 2012-10-01 00:44:44 -04:00
syscalltable.S m68k: Wire up finit_module 2012-12-25 20:14:56 +01:00
time.c m68k: set arch_gettimeoffset directly 2012-12-24 09:36:34 -07:00
traps.c dump_stack: consolidate dump_stack() implementations and unify their behaviors 2013-04-30 17:04:02 -07:00
vectors.c Disintegrate asm/system.h for M68K 2012-03-28 18:30:02 +01:00
vmlinux-nommu.lds m68k: Replace m68k-specific _[se]bss by generic __bss_{start,stop} 2012-06-27 09:59:43 +02:00
vmlinux-std.lds m68k: Replace m68k-specific _[se]bss by generic __bss_{start,stop} 2012-06-27 09:59:43 +02:00
vmlinux-sun3.lds m68k: Replace m68k-specific _[se]bss by generic __bss_{start,stop} 2012-06-27 09:59:43 +02:00
vmlinux.lds.S m68k: use non-MMU linker script for ColdFire MMU builds 2011-12-30 10:20:44 +10:00