1
0
Fork 0
alistair23-linux/arch/mips/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
..
cpufreq MIPS: Loongson2: Use clk API instead of direct dereferences 2013-02-15 23:07:37 +01:00
.gitignore [MIPS] Ignore vmlinux.lds generated files 2008-08-26 09:10:27 +01:00
8250-platform.c mips: remove needless include of module.h from core kernel files. 2011-10-31 19:30:57 -04:00
Makefile MIPS: Fix code generation for non-DSP capable CPUs 2013-03-19 19:15:35 +01:00
asm-offsets.c MIPS: Include PAGE_S{IZE,HIFT} in <asm/offset.h>. 2012-12-28 17:04:10 +01:00
binfmt_elfn32.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
binfmt_elfo32.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
bmips_vec.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
branch.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-bcm1480.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-ds1287.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-gt641xx.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-r4k.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-sb1250.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-smtc.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cevt-txx9.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cpu-bugs64.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
cpu-probe.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-04-05 12:23:12 -07:00
crash.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
crash_dump.c MIPS: Octeon: Add kexec and kdump support 2012-12-13 17:00:39 +01:00
csrc-bcm1480.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
csrc-gic.c MIPS: Add new GIC clocksource. 2013-02-17 01:25:21 +01:00
csrc-ioasic.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
csrc-powertv.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
csrc-r4k.c mips: convert to clocksource_register_hz/khz 2011-02-21 13:33:50 -08:00
csrc-sb1250.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
early_printk.c early_printk: consolidate random copies of identical code 2013-04-29 18:28:13 -07:00
entry.S Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-12-12 12:22:13 -08:00
ftrace.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
genex.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
gpio_txx9.c [MIPS] txx9: Make gpio_txx9 entirely spinlock-safe 2008-07-15 18:44:34 +01:00
head.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
i8253.c MIPS: irq: Remove IRQF_DISABLED 2011-12-07 22:03:45 +00:00
i8259.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
irq-gic.c MIPS: Make VPE count to be one-based. 2012-09-13 15:43:51 -05:00
irq-gt641xx.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
irq-msc01.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
irq-rm7000.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
irq.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
irq_cpu.c 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
irq_txx9.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
jump_label.c MIPS: jump label: Add MIPS support. 2011-01-18 19:30:24 +01:00
kgdb.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
kprobes.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
linux32.c MIPS: compat: Return same error ENOSYS as native for invalid operation. 2013-03-11 16:34:50 +01:00
machine_kexec.c MIPS: kdump: Add support 2012-12-13 16:46:47 +01:00
mcount.S MIPS: Unbreak function tracer for 64-bit kernel. 2013-04-05 15:10:22 +02:00
mips-mt-fpaff.c MIPS: MT: Fix build with CONFIG_UIDGID_STRICT_TYPE_CHECKS=y 2012-12-13 18:15:26 +01:00
mips-mt.c Merge branch 'master' into for-next 2012-04-08 21:48:52 +02:00
mips_ksyms.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
mips_machine.c MIPS: Add generic support for multiple machines within a single kernel 2011-01-18 19:30:21 +01:00
module-rela.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
module.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
octeon_switch.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
perf_event.c MIPS: perf: Reorganize contents of perf support files. 2011-10-24 23:34:26 +01:00
perf_event_mipsxx.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
proc.c MIPS: Fix inconsistent formatting inside /proc/cpuinfo 2013-03-13 23:08:36 +01:00
process.c mips: Use generic idle loop 2013-04-08 17:39:26 +02:00
prom.c MIPS: Prune some target specific code out of prom.c 2012-07-23 13:54:52 +01:00
ptrace.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
ptrace32.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
r4k_fpu.S update David Miller's old email address 2011-04-06 06:19:38 -07:00
r4k_switch.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
r2300_fpu.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
r2300_switch.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
r6000_fpu.S update David Miller's old email address 2011-04-06 06:19:38 -07:00
relocate_kernel.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
reset.c mips: migrate core kernel file from module.h --> export.h 2011-10-31 19:30:56 -04:00
rtlx.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
scall32-o32.S Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
scall64-64.S Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
scall64-n32.S Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
scall64-o32.S Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2013-03-02 08:34:06 -08:00
setup.c 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
signal-common.h most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set 2012-06-01 12:58:51 -04:00
signal.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
signal32.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
signal_n32.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
smp-bmips.c MIPS: BMIPS: delay irq enable to ->smp_finish() 2012-07-19 11:23:44 +02:00
smp-cmp.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
smp-mt.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
smp-up.c cpumask: arch_send_call_function_ipi_mask: mips 2009-09-24 09:34:45 +09:30
smp.c mips: Use generic idle loop 2013-04-08 17:39:26 +02:00
smtc-asm.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
smtc-proc.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
smtc.c 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
spinlock_test.c mips: migrate core kernel file from module.h --> export.h 2011-10-31 19:30:56 -04:00
spram.c Disintegrate asm/system.h for MIPS 2012-03-28 18:30:02 +01:00
stacktrace.c mips: migrate core kernel file from module.h --> export.h 2011-10-31 19:30:56 -04:00
sync-r4k.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
syscall.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
time.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
topology.c MIPS: Add arch generic CPU hotplug 2009-06-24 18:34:40 +01:00
traps.c dump_stack: consolidate dump_stack() implementations and unify their behaviors 2013-04-30 17:04:02 -07:00
unaligned.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
vdso.c coredump: remove VM_ALWAYSDUMP flag 2012-03-23 16:58:42 -07:00
vmlinux.lds.S MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
vpe.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
watch.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00