1
0
Fork 0
alistair23-linux/arch/mips
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
..
alchemy MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
ar7 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
ath79 Merge git://www.linux-watchdog.org/linux-watchdog 2013-03-03 10:23:29 -08:00
bcm47xx Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into mips-for-linux-next 2013-02-22 10:07:30 +01:00
bcm63xx spi: Updates for v3.10 2013-04-29 16:38:41 -07:00
boot MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cavium-octeon MIPS: Fix build error cavium-octeon without CONFIG_SMP 2013-04-05 15:10:39 +02:00
cobalt MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
configs Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
dec MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
emma MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
fw MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
include Merge branch 'akpm' (incoming from Andrew) 2013-04-29 17:29:08 -07:00
jazz Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
jz4740 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
kernel dump_stack: consolidate dump_stack() implementations and unify their behaviors 2013-04-30 17:04:02 -07:00
lantiq Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
lasat Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
lib MIPS: Fix logic errors in bitops.c 2013-03-12 18:57:47 +01:00
loongson MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
loongson1 Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
math-emu MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
mm mm/MIPS: use free_highmem_page() to free highmem pages into buddy system 2013-04-29 15:54:32 -07:00
mti-malta Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
mti-sead3 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
netlogic Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
oprofile Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
pci PCI changes for the v3.10 merge window: 2013-04-29 09:30:25 -07:00
pmcs-msp71xx MIPS: MSP71xx: Move code. 2013-02-01 10:00:22 +01:00
pnx833x MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
power MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
powertv MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
ralink MIPS: ralink: add CPU interrupt controller to of_irq_ids 2013-02-17 01:25:34 +01:00
rb532 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip22 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip27 mm/MIPS: use common help functions to free reserved pages 2013-04-29 15:54:30 -07:00
sgi-ip32 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sibyte MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sni Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
txx9 Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
vr41xx MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
wrppmc MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
Kbuild
Kbuild.platforms Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next 2013-02-21 12:51:33 +01:00
Kconfig idle: Remove GENERIC_IDLE_LOOP config switch 2013-04-17 10:39:38 +02:00
Kconfig.debug Fix typo in various Kconfig file 2012-04-16 14:40:08 +02:00
Makefile MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00