diff options
author | Tejun Heo <tj@kernel.org> | 2013-04-30 18:27:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:04:02 -0400 |
commit | a43cb95d547a061ed5bf1acb28e0f5fd575e26c1 (patch) | |
tree | 69bcede26748d00907f6019dee446f538c64dbd2 /arch | |
parent | 98e5e1bf722c4f976a860aed06dd365a56a34ee0 (diff) |
dump_stack: unify debug information printed by show_regs()
show_regs() is inherently arch-dependent but it does make sense to print
generic debug information and some archs already do albeit in slightly
different forms. This patch introduces a generic function to print debug
information from show_regs() so that different archs print out the same
information and it's much easier to modify what's printed.
show_regs_print_info() prints out the same debug info as dump_stack()
does plus task and thread_info pointers.
* Archs which didn't print debug info now do.
alpha, arc, blackfin, c6x, cris, frv, h8300, hexagon, ia64, m32r,
metag, microblaze, mn10300, openrisc, parisc, score, sh64, sparc,
um, xtensa
* Already prints debug info. Replaced with show_regs_print_info().
The printed information is superset of what used to be there.
arm, arm64, avr32, mips, powerpc, sh32, tile, unicore32, x86
* s390 is special in that it used to print arch-specific information
along with generic debug info. Heiko and Martin think that the
arch-specific extra isn't worth keeping s390 specfic implementation.
Converted to use the generic version.
Note that now all archs print the debug info before actual register
dumps.
An example BUG() dump follows.
kernel BUG at /work/os/work/kernel/workqueue.c:4841!
invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #7
Hardware name: empty empty/S3992, BIOS 080011 10/26/2007
task: ffff88007c85e040 ti: ffff88007c860000 task.ti: ffff88007c860000
RIP: 0010:[<ffffffff8234a07e>] [<ffffffff8234a07e>] init_workqueues+0x4/0x6
RSP: 0000:ffff88007c861ec8 EFLAGS: 00010246
RAX: ffff88007c861fd8 RBX: ffffffff824466a8 RCX: 0000000000000001
RDX: 0000000000000046 RSI: 0000000000000001 RDI: ffffffff8234a07a
RBP: ffff88007c861ec8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff8234a07a
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff88007dc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: ffff88015f7ff000 CR3: 00000000021f1000 CR4: 00000000000007f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Stack:
ffff88007c861ef8 ffffffff81000312 ffffffff824466a8 ffff88007c85e650
0000000000000003 0000000000000000 ffff88007c861f38 ffffffff82335e5d
ffff88007c862080 ffffffff8223d8c0 ffff88007c862080 ffffffff81c47760
Call Trace:
[<ffffffff81000312>] do_one_initcall+0x122/0x170
[<ffffffff82335e5d>] kernel_init_freeable+0x9b/0x1c8
[<ffffffff81c47760>] ? rest_init+0x140/0x140
[<ffffffff81c4776e>] kernel_init+0xe/0xf0
[<ffffffff81c6be9c>] ret_from_fork+0x7c/0xb0
[<ffffffff81c47760>] ? rest_init+0x140/0x140
...
v2: Typo fix in x86-32.
v3: CPU number dropped from show_regs_print_info() as
dump_stack_print_info() has been updated to print it. s390
specific implementation dropped as requested by s390 maintainers.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [tile bits]
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>
Diffstat (limited to 'arch')
37 files changed, 53 insertions, 84 deletions
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index a3fd8a29ccac..ab80a80d38a2 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -175,6 +175,7 @@ machine_power_off(void) | |||
175 | void | 175 | void |
176 | show_regs(struct pt_regs *regs) | 176 | show_regs(struct pt_regs *regs) |
177 | { | 177 | { |
178 | show_regs_print_info(KERN_DEFAULT); | ||
178 | dik_show_regs(regs, NULL); | 179 | dik_show_regs(regs, NULL); |
179 | } | 180 | } |
180 | 181 | ||
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index 7c10873c311f..96be1e6e76d8 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c | |||
@@ -163,6 +163,7 @@ void show_regs(struct pt_regs *regs) | |||
163 | return; | 163 | return; |
164 | 164 | ||
165 | print_task_path_n_nm(tsk, buf); | 165 | print_task_path_n_nm(tsk, buf); |
166 | show_regs_print_info(KERN_INFO); | ||
166 | 167 | ||
167 | if (current->thread.cause_code) | 168 | if (current->thread.cause_code) |
168 | show_ecr_verbose(regs); | 169 | show_ecr_verbose(regs); |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index c9a5e2ce8aa9..ae58d3b37d9d 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -225,11 +225,8 @@ void __show_regs(struct pt_regs *regs) | |||
225 | unsigned long flags; | 225 | unsigned long flags; |
226 | char buf[64]; | 226 | char buf[64]; |
227 | 227 | ||
228 | printk("CPU: %d %s (%s %.*s)\n", | 228 | show_regs_print_info(KERN_DEFAULT); |
229 | raw_smp_processor_id(), print_tainted(), | 229 | |
230 | init_utsname()->release, | ||
231 | (int)strcspn(init_utsname()->version, " "), | ||
232 | init_utsname()->version); | ||
233 | print_symbol("PC is at %s\n", instruction_pointer(regs)); | 230 | print_symbol("PC is at %s\n", instruction_pointer(regs)); |
234 | print_symbol("LR is at %s\n", regs->ARM_lr); | 231 | print_symbol("LR is at %s\n", regs->ARM_lr); |
235 | printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" | 232 | printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" |
@@ -284,7 +281,6 @@ void __show_regs(struct pt_regs *regs) | |||
284 | void show_regs(struct pt_regs * regs) | 281 | void show_regs(struct pt_regs * regs) |
285 | { | 282 | { |
286 | printk("\n"); | 283 | printk("\n"); |
287 | printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm); | ||
288 | __show_regs(regs); | 284 | __show_regs(regs); |
289 | dump_stack(); | 285 | dump_stack(); |
290 | } | 286 | } |
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 6f3822f98dcd..f4919721f7dd 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c | |||
@@ -145,11 +145,7 @@ void __show_regs(struct pt_regs *regs) | |||
145 | { | 145 | { |
146 | int i; | 146 | int i; |
147 | 147 | ||
148 | printk("CPU: %d %s (%s %.*s)\n", | 148 | show_regs_print_info(KERN_DEFAULT); |
149 | raw_smp_processor_id(), print_tainted(), | ||
150 | init_utsname()->release, | ||
151 | (int)strcspn(init_utsname()->version, " "), | ||
152 | init_utsname()->version); | ||
153 | print_symbol("PC is at %s\n", instruction_pointer(regs)); | 149 | print_symbol("PC is at %s\n", instruction_pointer(regs)); |
154 | print_symbol("LR is at %s\n", regs->regs[30]); | 150 | print_symbol("LR is at %s\n", regs->regs[30]); |
155 | printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", | 151 | printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", |
@@ -166,7 +162,6 @@ void __show_regs(struct pt_regs *regs) | |||
166 | void show_regs(struct pt_regs * regs) | 162 | void show_regs(struct pt_regs * regs) |
167 | { | 163 | { |
168 | printk("\n"); | 164 | printk("\n"); |
169 | printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm); | ||
170 | __show_regs(regs); | 165 | __show_regs(regs); |
171 | } | 166 | } |
172 | 167 | ||
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c index 89a8017e8ca6..e7b61494c312 100644 --- a/arch/avr32/kernel/process.c +++ b/arch/avr32/kernel/process.c | |||
@@ -215,6 +215,8 @@ void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl) | |||
215 | unsigned long lr = regs->lr; | 215 | unsigned long lr = regs->lr; |
216 | unsigned long mode = (regs->sr & MODE_MASK) >> MODE_SHIFT; | 216 | unsigned long mode = (regs->sr & MODE_MASK) >> MODE_SHIFT; |
217 | 217 | ||
218 | show_regs_print_info(log_lvl); | ||
219 | |||
218 | if (!user_mode(regs)) { | 220 | if (!user_mode(regs)) { |
219 | sp = (unsigned long)regs + FRAME_SIZE_FULL; | 221 | sp = (unsigned long)regs + FRAME_SIZE_FULL; |
220 | 222 | ||
@@ -252,9 +254,6 @@ void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl) | |||
252 | regs->sr & SR_I0M ? '0' : '.', | 254 | regs->sr & SR_I0M ? '0' : '.', |
253 | regs->sr & SR_GM ? 'G' : 'g'); | 255 | regs->sr & SR_GM ? 'G' : 'g'); |
254 | printk("%sCPU Mode: %s\n", log_lvl, cpu_modes[mode]); | 256 | printk("%sCPU Mode: %s\n", log_lvl, cpu_modes[mode]); |
255 | printk("%sProcess: %s [%d] (task: %p thread: %p)\n", | ||
256 | log_lvl, current->comm, current->pid, current, | ||
257 | task_thread_info(current)); | ||
258 | } | 257 | } |
259 | 258 | ||
260 | void show_regs(struct pt_regs *regs) | 259 | void show_regs(struct pt_regs *regs) |
diff --git a/arch/blackfin/kernel/trace.c b/arch/blackfin/kernel/trace.c index f7f7a18abca9..c36efa0c7163 100644 --- a/arch/blackfin/kernel/trace.c +++ b/arch/blackfin/kernel/trace.c | |||
@@ -853,6 +853,8 @@ void show_regs(struct pt_regs *fp) | |||
853 | unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); | 853 | unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); |
854 | 854 | ||
855 | pr_notice("\n"); | 855 | pr_notice("\n"); |
856 | show_regs_print_info(KERN_NOTICE); | ||
857 | |||
856 | if (CPUID != bfin_cpuid()) | 858 | if (CPUID != bfin_cpuid()) |
857 | pr_notice("Compiled for cpu family 0x%04x (Rev %d), " | 859 | pr_notice("Compiled for cpu family 0x%04x (Rev %d), " |
858 | "but running on:0x%04x (Rev %d)\n", | 860 | "but running on:0x%04x (Rev %d)\n", |
diff --git a/arch/c6x/kernel/traps.c b/arch/c6x/kernel/traps.c index d0b96ef25c17..dcc2c2f6d67c 100644 --- a/arch/c6x/kernel/traps.c +++ b/arch/c6x/kernel/traps.c | |||
@@ -31,6 +31,7 @@ void __init trap_init(void) | |||
31 | void show_regs(struct pt_regs *regs) | 31 | void show_regs(struct pt_regs *regs) |
32 | { | 32 | { |
33 | pr_err("\n"); | 33 | pr_err("\n"); |
34 | show_regs_print_info(KERN_ERR); | ||
34 | pr_err("PC: %08lx SP: %08lx\n", regs->pc, regs->sp); | 35 | pr_err("PC: %08lx SP: %08lx\n", regs->pc, regs->sp); |
35 | pr_err("Status: %08lx ORIG_A4: %08lx\n", regs->csr, regs->orig_a4); | 36 | pr_err("Status: %08lx ORIG_A4: %08lx\n", regs->csr, regs->orig_a4); |
36 | pr_err("A0: %08lx B0: %08lx\n", regs->a0, regs->b0); | 37 | pr_err("A0: %08lx B0: %08lx\n", regs->a0, regs->b0); |
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c index 2ba23c13df68..753e9a03cf87 100644 --- a/arch/cris/arch-v10/kernel/process.c +++ b/arch/cris/arch-v10/kernel/process.c | |||
@@ -176,6 +176,9 @@ unsigned long get_wchan(struct task_struct *p) | |||
176 | void show_regs(struct pt_regs * regs) | 176 | void show_regs(struct pt_regs * regs) |
177 | { | 177 | { |
178 | unsigned long usp = rdusp(); | 178 | unsigned long usp = rdusp(); |
179 | |||
180 | show_regs_print_info(KERN_DEFAULT); | ||
181 | |||
179 | printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", | 182 | printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", |
180 | regs->irp, regs->srp, regs->dccr, usp, regs->mof ); | 183 | regs->irp, regs->srp, regs->dccr, usp, regs->mof ); |
181 | printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", | 184 | printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", |
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c index 57451faa9b20..cebd32e2a8fb 100644 --- a/arch/cris/arch-v32/kernel/process.c +++ b/arch/cris/arch-v32/kernel/process.c | |||
@@ -164,6 +164,9 @@ get_wchan(struct task_struct *p) | |||
164 | void show_regs(struct pt_regs * regs) | 164 | void show_regs(struct pt_regs * regs) |
165 | { | 165 | { |
166 | unsigned long usp = rdusp(); | 166 | unsigned long usp = rdusp(); |
167 | |||
168 | show_regs_print_info(KERN_DEFAULT); | ||
169 | |||
167 | printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n", | 170 | printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n", |
168 | regs->erp, regs->srp, regs->ccs, usp, regs->mof); | 171 | regs->erp, regs->srp, regs->ccs, usp, regs->mof); |
169 | 172 | ||
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c index cfcd802d6f9c..4bff48c19d29 100644 --- a/arch/frv/kernel/traps.c +++ b/arch/frv/kernel/traps.c | |||
@@ -497,6 +497,7 @@ void show_regs(struct pt_regs *regs) | |||
497 | int loop; | 497 | int loop; |
498 | 498 | ||
499 | printk("\n"); | 499 | printk("\n"); |
500 | show_regs_print_info(KERN_DEFAULT); | ||
500 | 501 | ||
501 | printk("Frame: @%08lx [%s]\n", | 502 | printk("Frame: @%08lx [%s]\n", |
502 | (unsigned long) regs, | 503 | (unsigned long) regs, |
@@ -511,8 +512,6 @@ void show_regs(struct pt_regs *regs) | |||
511 | else | 512 | else |
512 | printk(" | "); | 513 | printk(" | "); |
513 | } | 514 | } |
514 | |||
515 | printk("Process %s (pid: %d)\n", current->comm, current->pid); | ||
516 | } | 515 | } |
517 | 516 | ||
518 | void die_if_kernel(const char *str, ...) | 517 | void die_if_kernel(const char *str, ...) |
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c index a17d2cd463d2..1a744ab7e7e5 100644 --- a/arch/h8300/kernel/process.c +++ b/arch/h8300/kernel/process.c | |||
@@ -83,6 +83,8 @@ void machine_power_off(void) | |||
83 | 83 | ||
84 | void show_regs(struct pt_regs * regs) | 84 | void show_regs(struct pt_regs * regs) |
85 | { | 85 | { |
86 | show_regs_print_info(KERN_DEFAULT); | ||
87 | |||
86 | printk("\nPC: %08lx Status: %02x", | 88 | printk("\nPC: %08lx Status: %02x", |
87 | regs->pc, regs->ccr); | 89 | regs->pc, regs->ccr); |
88 | printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx", | 90 | printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx", |
diff --git a/arch/hexagon/kernel/vm_events.c b/arch/hexagon/kernel/vm_events.c index 9b5a4a295a68..f337281ebe67 100644 --- a/arch/hexagon/kernel/vm_events.c +++ b/arch/hexagon/kernel/vm_events.c | |||
@@ -33,6 +33,8 @@ | |||
33 | */ | 33 | */ |
34 | void show_regs(struct pt_regs *regs) | 34 | void show_regs(struct pt_regs *regs) |
35 | { | 35 | { |
36 | show_regs_print_info(KERN_EMERG); | ||
37 | |||
36 | printk(KERN_EMERG "restart_r0: \t0x%08lx syscall_nr: %ld\n", | 38 | printk(KERN_EMERG "restart_r0: \t0x%08lx syscall_nr: %ld\n", |
37 | regs->restart_r0, regs->syscall_nr); | 39 | regs->restart_r0, regs->syscall_nr); |
38 | printk(KERN_EMERG "preds: \t\t0x%08lx\n", regs->preds); | 40 | printk(KERN_EMERG "preds: \t\t0x%08lx\n", regs->preds); |
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 182bd64cc726..55d4ba47a907 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -101,8 +101,8 @@ show_regs (struct pt_regs *regs) | |||
101 | unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; | 101 | unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; |
102 | 102 | ||
103 | print_modules(); | 103 | print_modules(); |
104 | printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current), | 104 | printk("\n"); |
105 | smp_processor_id(), current->comm); | 105 | show_regs_print_info(KERN_DEFAULT); |
106 | printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n", | 106 | printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n", |
107 | regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(), | 107 | regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(), |
108 | init_utsname()->release); | 108 | init_utsname()->release); |
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index e2d049018c3b..e69221d581d5 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c | |||
@@ -73,6 +73,8 @@ void machine_power_off(void) | |||
73 | void show_regs(struct pt_regs * regs) | 73 | void show_regs(struct pt_regs * regs) |
74 | { | 74 | { |
75 | printk("\n"); | 75 | printk("\n"); |
76 | show_regs_print_info(KERN_DEFAULT); | ||
77 | |||
76 | printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \ | 78 | printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \ |
77 | regs->bpc, regs->psw, regs->lr, regs->fp); | 79 | regs->bpc, regs->psw, regs->lr, regs->fp); |
78 | printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \ | 80 | printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \ |
diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c index dc5923544560..483dff986a23 100644 --- a/arch/metag/kernel/process.c +++ b/arch/metag/kernel/process.c | |||
@@ -129,6 +129,8 @@ void show_regs(struct pt_regs *regs) | |||
129 | "D1.7 " | 129 | "D1.7 " |
130 | }; | 130 | }; |
131 | 131 | ||
132 | show_regs_print_info(KERN_INFO); | ||
133 | |||
132 | pr_info(" pt_regs @ %p\n", regs); | 134 | pr_info(" pt_regs @ %p\n", regs); |
133 | pr_info(" SaveMask = 0x%04hx\n", regs->ctx.SaveMask); | 135 | pr_info(" SaveMask = 0x%04hx\n", regs->ctx.SaveMask); |
134 | pr_info(" Flags = 0x%04hx (%c%c%c%c)\n", regs->ctx.Flags, | 136 | pr_info(" Flags = 0x%04hx (%c%c%c%c)\n", regs->ctx.Flags, |
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c index 7cce2e9c1719..a55893807274 100644 --- a/arch/microblaze/kernel/process.c +++ b/arch/microblaze/kernel/process.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | void show_regs(struct pt_regs *regs) | 21 | void show_regs(struct pt_regs *regs) |
22 | { | 22 | { |
23 | show_regs_print_info(KERN_INFO); | ||
24 | |||
23 | pr_info(" Registers dump: mode=%X\r\n", regs->pt_mode); | 25 | pr_info(" Registers dump: mode=%X\r\n", regs->pt_mode); |
24 | pr_info(" r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n", | 26 | pr_info(" r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n", |
25 | regs->r1, regs->r2, regs->r3, regs->r4); | 27 | regs->r1, regs->r2, regs->r3, regs->r4); |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index b512b28cf786..25225515451f 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -231,7 +231,7 @@ static void __show_regs(const struct pt_regs *regs) | |||
231 | unsigned int cause = regs->cp0_cause; | 231 | unsigned int cause = regs->cp0_cause; |
232 | int i; | 232 | int i; |
233 | 233 | ||
234 | printk("Cpu %d\n", smp_processor_id()); | 234 | show_regs_print_info(KERN_DEFAULT); |
235 | 235 | ||
236 | /* | 236 | /* |
237 | * Saved main processor registers | 237 | * Saved main processor registers |
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 2da39fb8b3b2..3707da583d05 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -97,6 +97,7 @@ void machine_power_off(void) | |||
97 | 97 | ||
98 | void show_regs(struct pt_regs *regs) | 98 | void show_regs(struct pt_regs *regs) |
99 | { | 99 | { |
100 | show_regs_print_info(KERN_DEFAULT); | ||
100 | } | 101 | } |
101 | 102 | ||
102 | /* | 103 | /* |
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c index 00c233bf0d06..386af258591d 100644 --- a/arch/openrisc/kernel/process.c +++ b/arch/openrisc/kernel/process.c | |||
@@ -90,6 +90,7 @@ void show_regs(struct pt_regs *regs) | |||
90 | { | 90 | { |
91 | extern void show_registers(struct pt_regs *regs); | 91 | extern void show_registers(struct pt_regs *regs); |
92 | 92 | ||
93 | show_regs_print_info(KERN_DEFAULT); | ||
93 | /* __PHX__ cleanup this mess */ | 94 | /* __PHX__ cleanup this mess */ |
94 | show_registers(regs); | 95 | show_registers(regs); |
95 | } | 96 | } |
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index e64cf5f09b62..f702bff0bed9 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c | |||
@@ -126,6 +126,8 @@ void show_regs(struct pt_regs *regs) | |||
126 | user = user_mode(regs); | 126 | user = user_mode(regs); |
127 | level = user ? KERN_DEBUG : KERN_CRIT; | 127 | level = user ? KERN_DEBUG : KERN_CRIT; |
128 | 128 | ||
129 | show_regs_print_info(level); | ||
130 | |||
129 | print_gr(level, regs); | 131 | print_gr(level, regs); |
130 | 132 | ||
131 | for (i = 0; i < 8; i += 4) | 133 | for (i = 0; i < 8; i += 4) |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 624d44bb44dc..13a8d9d0b5cb 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -831,6 +831,8 @@ void show_regs(struct pt_regs * regs) | |||
831 | { | 831 | { |
832 | int i, trap; | 832 | int i, trap; |
833 | 833 | ||
834 | show_regs_print_info(KERN_DEFAULT); | ||
835 | |||
834 | printk("NIP: "REG" LR: "REG" CTR: "REG"\n", | 836 | printk("NIP: "REG" LR: "REG" CTR: "REG"\n", |
835 | regs->nip, regs->link, regs->ctr); | 837 | regs->nip, regs->link, regs->ctr); |
836 | printk("REGS: %p TRAP: %04lx %s (%s)\n", | 838 | printk("REGS: %p TRAP: %04lx %s (%s)\n", |
@@ -850,12 +852,6 @@ void show_regs(struct pt_regs * regs) | |||
850 | #else | 852 | #else |
851 | printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); | 853 | printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); |
852 | #endif | 854 | #endif |
853 | printk("TASK = %p[%d] '%s' THREAD: %p", | ||
854 | current, task_pid_nr(current), current->comm, task_thread_info(current)); | ||
855 | |||
856 | #ifdef CONFIG_SMP | ||
857 | printk(" CPU: %d", raw_smp_processor_id()); | ||
858 | #endif /* CONFIG_SMP */ | ||
859 | 855 | ||
860 | for (i = 0; i < 32; i++) { | 856 | for (i = 0; i < 32; i++) { |
861 | if ((i % REGS_PER_LINE) == 0) | 857 | if ((i % REGS_PER_LINE) == 0) |
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c index 2f1f639d1a3d..298297477257 100644 --- a/arch/s390/kernel/dumpstack.c +++ b/arch/s390/kernel/dumpstack.c | |||
@@ -166,14 +166,7 @@ void show_registers(struct pt_regs *regs) | |||
166 | 166 | ||
167 | void show_regs(struct pt_regs *regs) | 167 | void show_regs(struct pt_regs *regs) |
168 | { | 168 | { |
169 | printk("CPU: %d %s %s %.*s\n", | 169 | show_regs_print_info(KERN_DEFAULT); |
170 | task_thread_info(current)->cpu, print_tainted(), | ||
171 | init_utsname()->release, | ||
172 | (int)strcspn(init_utsname()->version, " "), | ||
173 | init_utsname()->version); | ||
174 | printk("Process %s (pid: %d, task: %p, ksp: %p)\n", | ||
175 | current->comm, current->pid, current, | ||
176 | (void *) current->thread.ksp); | ||
177 | show_registers(regs); | 170 | show_registers(regs); |
178 | /* Show stack backtrace if pt_regs is from kernel mode */ | 171 | /* Show stack backtrace if pt_regs is from kernel mode */ |
179 | if (!user_mode(regs)) | 172 | if (!user_mode(regs)) |
diff --git a/arch/score/kernel/traps.c b/arch/score/kernel/traps.c index a38f435fba7b..1517a7dcd6d9 100644 --- a/arch/score/kernel/traps.c +++ b/arch/score/kernel/traps.c | |||
@@ -117,6 +117,8 @@ static void show_code(unsigned int *pc) | |||
117 | */ | 117 | */ |
118 | void show_regs(struct pt_regs *regs) | 118 | void show_regs(struct pt_regs *regs) |
119 | { | 119 | { |
120 | show_regs_print_info(KERN_DEFAULT); | ||
121 | |||
120 | printk("r0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", | 122 | printk("r0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", |
121 | regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3], | 123 | regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3], |
122 | regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); | 124 | regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); |
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 73eb66fc6253..ebd3933005b4 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c | |||
@@ -32,11 +32,7 @@ | |||
32 | void show_regs(struct pt_regs * regs) | 32 | void show_regs(struct pt_regs * regs) |
33 | { | 33 | { |
34 | printk("\n"); | 34 | printk("\n"); |
35 | printk("Pid : %d, Comm: \t\t%s\n", task_pid_nr(current), current->comm); | 35 | show_regs_print_info(KERN_DEFAULT); |
36 | printk("CPU : %d \t\t%s (%s %.*s)\n\n", | ||
37 | smp_processor_id(), print_tainted(), init_utsname()->release, | ||
38 | (int)strcspn(init_utsname()->version, " "), | ||
39 | init_utsname()->version); | ||
40 | 36 | ||
41 | print_symbol("PC is at %s\n", instruction_pointer(regs)); | 37 | print_symbol("PC is at %s\n", instruction_pointer(regs)); |
42 | print_symbol("PR is at %s\n", regs->pr); | 38 | print_symbol("PR is at %s\n", regs->pr); |
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c index e611c85144b1..174d124b419e 100644 --- a/arch/sh/kernel/process_64.c +++ b/arch/sh/kernel/process_64.c | |||
@@ -40,6 +40,7 @@ void show_regs(struct pt_regs *regs) | |||
40 | unsigned long long ah, al, bh, bl, ch, cl; | 40 | unsigned long long ah, al, bh, bl, ch, cl; |
41 | 41 | ||
42 | printk("\n"); | 42 | printk("\n"); |
43 | show_regs_print_info(KERN_DEFAULT); | ||
43 | 44 | ||
44 | ah = (regs->pc) >> 32; | 45 | ah = (regs->pc) >> 32; |
45 | al = (regs->pc) & 0xffffffff; | 46 | al = (regs->pc) & 0xffffffff; |
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index dccf5f58d70f..fdd819dfdacf 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c | |||
@@ -112,6 +112,8 @@ void show_regs(struct pt_regs *r) | |||
112 | { | 112 | { |
113 | struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14]; | 113 | struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14]; |
114 | 114 | ||
115 | show_regs_print_info(KERN_DEFAULT); | ||
116 | |||
115 | printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n", | 117 | printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n", |
116 | r->psr, r->pc, r->npc, r->y, print_tainted()); | 118 | r->psr, r->pc, r->npc, r->y, print_tainted()); |
117 | printk("PC: <%pS>\n", (void *) r->pc); | 119 | printk("PC: <%pS>\n", (void *) r->pc); |
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 9fbf0d14a361..c6dc1ba069ca 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
@@ -163,6 +163,8 @@ static void show_regwindow(struct pt_regs *regs) | |||
163 | 163 | ||
164 | void show_regs(struct pt_regs *regs) | 164 | void show_regs(struct pt_regs *regs) |
165 | { | 165 | { |
166 | show_regs_print_info(KERN_DEFAULT); | ||
167 | |||
166 | printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate, | 168 | printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate, |
167 | regs->tpc, regs->tnpc, regs->y, print_tainted()); | 169 | regs->tpc, regs->tnpc, regs->y, print_tainted()); |
168 | printk("TPC: <%pS>\n", (void *) regs->tpc); | 170 | printk("TPC: <%pS>\n", (void *) regs->tpc); |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 80b2a18deb87..8ac304484f98 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -573,8 +573,7 @@ void show_regs(struct pt_regs *regs) | |||
573 | int i; | 573 | int i; |
574 | 574 | ||
575 | pr_err("\n"); | 575 | pr_err("\n"); |
576 | pr_err(" Pid: %d, comm: %20s, CPU: %d\n", | 576 | show_regs_print_info(KERN_ERR); |
577 | tsk->pid, tsk->comm, smp_processor_id()); | ||
578 | #ifdef __tilegx__ | 577 | #ifdef __tilegx__ |
579 | for (i = 0; i < 51; i += 3) | 578 | for (i = 0; i < 51; i += 3) |
580 | pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n", | 579 | pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n", |
diff --git a/arch/um/sys-ppc/sysrq.c b/arch/um/sys-ppc/sysrq.c index f889449f9285..1ff1ad7f27da 100644 --- a/arch/um/sys-ppc/sysrq.c +++ b/arch/um/sys-ppc/sysrq.c | |||
@@ -11,6 +11,8 @@ | |||
11 | void show_regs(struct pt_regs_subarch *regs) | 11 | void show_regs(struct pt_regs_subarch *regs) |
12 | { | 12 | { |
13 | printk("\n"); | 13 | printk("\n"); |
14 | show_regs_print_info(KERN_DEFAULT); | ||
15 | |||
14 | printk("show_regs(): insert regs here.\n"); | 16 | printk("show_regs(): insert regs here.\n"); |
15 | #if 0 | 17 | #if 0 |
16 | printk("\n"); | 18 | printk("\n"); |
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c index 7fab86d7c5d4..c9447691bdac 100644 --- a/arch/unicore32/kernel/process.c +++ b/arch/unicore32/kernel/process.c | |||
@@ -144,11 +144,7 @@ void __show_regs(struct pt_regs *regs) | |||
144 | unsigned long flags; | 144 | unsigned long flags; |
145 | char buf[64]; | 145 | char buf[64]; |
146 | 146 | ||
147 | printk(KERN_DEFAULT "CPU: %d %s (%s %.*s)\n", | 147 | show_regs_print_info(KERN_DEFAULT); |
148 | raw_smp_processor_id(), print_tainted(), | ||
149 | init_utsname()->release, | ||
150 | (int)strcspn(init_utsname()->version, " "), | ||
151 | init_utsname()->version); | ||
152 | print_symbol("PC is at %s\n", instruction_pointer(regs)); | 148 | print_symbol("PC is at %s\n", instruction_pointer(regs)); |
153 | print_symbol("LR is at %s\n", regs->UCreg_lr); | 149 | print_symbol("LR is at %s\n", regs->UCreg_lr); |
154 | printk(KERN_DEFAULT "pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" | 150 | printk(KERN_DEFAULT "pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" |
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index 11e1152222d0..2f03ff018d36 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h | |||
@@ -37,7 +37,4 @@ do { \ | |||
37 | 37 | ||
38 | #include <asm-generic/bug.h> | 38 | #include <asm-generic/bug.h> |
39 | 39 | ||
40 | |||
41 | extern void show_regs_common(void); | ||
42 | |||
43 | #endif /* _ASM_X86_BUG_H */ | 40 | #endif /* _ASM_X86_BUG_H */ |
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c index 1038a417ea53..f2a1770ca176 100644 --- a/arch/x86/kernel/dumpstack_32.c +++ b/arch/x86/kernel/dumpstack_32.c | |||
@@ -86,11 +86,9 @@ void show_regs(struct pt_regs *regs) | |||
86 | { | 86 | { |
87 | int i; | 87 | int i; |
88 | 88 | ||
89 | show_regs_print_info(KERN_EMERG); | ||
89 | __show_regs(regs, !user_mode_vm(regs)); | 90 | __show_regs(regs, !user_mode_vm(regs)); |
90 | 91 | ||
91 | pr_emerg("Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n", | ||
92 | TASK_COMM_LEN, current->comm, task_pid_nr(current), | ||
93 | current_thread_info(), current, task_thread_info(current)); | ||
94 | /* | 92 | /* |
95 | * When in-kernel, we also print out the stack and code at the | 93 | * When in-kernel, we also print out the stack and code at the |
96 | * time of the fault.. | 94 | * time of the fault.. |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index b653675d5288..addb207dab92 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -249,14 +249,10 @@ void show_regs(struct pt_regs *regs) | |||
249 | { | 249 | { |
250 | int i; | 250 | int i; |
251 | unsigned long sp; | 251 | unsigned long sp; |
252 | const int cpu = smp_processor_id(); | ||
253 | struct task_struct *cur = current; | ||
254 | 252 | ||
255 | sp = regs->sp; | 253 | sp = regs->sp; |
256 | printk("CPU %d ", cpu); | 254 | show_regs_print_info(KERN_DEFAULT); |
257 | __show_regs(regs, 1); | 255 | __show_regs(regs, 1); |
258 | printk(KERN_DEFAULT "Process %s (pid: %d, threadinfo %p, task %p)\n", | ||
259 | cur->comm, cur->pid, task_thread_info(cur), cur); | ||
260 | 256 | ||
261 | /* | 257 | /* |
262 | * When in-kernel, we also print out the stack and code at the | 258 | * When in-kernel, we also print out the stack and code at the |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 14fcf55a5c5b..607af0d4d5ef 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -121,30 +121,6 @@ void exit_thread(void) | |||
121 | drop_fpu(me); | 121 | drop_fpu(me); |
122 | } | 122 | } |
123 | 123 | ||
124 | void show_regs_common(void) | ||
125 | { | ||
126 | const char *vendor, *product, *board; | ||
127 | |||
128 | vendor = dmi_get_system_info(DMI_SYS_VENDOR); | ||
129 | if (!vendor) | ||
130 | vendor = ""; | ||
131 | product = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
132 | if (!product) | ||
133 | product = ""; | ||
134 | |||
135 | /* Board Name is optional */ | ||
136 | board = dmi_get_system_info(DMI_BOARD_NAME); | ||
137 | |||
138 | printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n", | ||
139 | current->pid, current->comm, print_tainted(), | ||
140 | init_utsname()->release, | ||
141 | (int)strcspn(init_utsname()->version, " "), | ||
142 | init_utsname()->version, | ||
143 | vendor, product, | ||
144 | board ? "/" : "", | ||
145 | board ? board : ""); | ||
146 | } | ||
147 | |||
148 | void flush_thread(void) | 124 | void flush_thread(void) |
149 | { | 125 | { |
150 | struct task_struct *tsk = current; | 126 | struct task_struct *tsk = current; |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index b5a8905785e6..7305f7dfc7ab 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -84,8 +84,6 @@ void __show_regs(struct pt_regs *regs, int all) | |||
84 | savesegment(gs, gs); | 84 | savesegment(gs, gs); |
85 | } | 85 | } |
86 | 86 | ||
87 | show_regs_common(); | ||
88 | |||
89 | printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | 87 | printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", |
90 | (u16)regs->cs, regs->ip, regs->flags, | 88 | (u16)regs->cs, regs->ip, regs->flags, |
91 | smp_processor_id()); | 89 | smp_processor_id()); |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 0f49677da51e..355ae06dbf94 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -62,7 +62,6 @@ void __show_regs(struct pt_regs *regs, int all) | |||
62 | unsigned int fsindex, gsindex; | 62 | unsigned int fsindex, gsindex; |
63 | unsigned int ds, cs, es; | 63 | unsigned int ds, cs, es; |
64 | 64 | ||
65 | show_regs_common(); | ||
66 | printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); | 65 | printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); |
67 | printk_address(regs->ip, 1); | 66 | printk_address(regs->ip, 1); |
68 | printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, | 67 | printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, |
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 384b7c7c2f6d..458186dab5dc 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -383,6 +383,8 @@ void show_regs(struct pt_regs * regs) | |||
383 | { | 383 | { |
384 | int i, wmask; | 384 | int i, wmask; |
385 | 385 | ||
386 | show_regs_print_info(KERN_DEFAULT); | ||
387 | |||
386 | wmask = regs->wmask & ~1; | 388 | wmask = regs->wmask & ~1; |
387 | 389 | ||
388 | for (i = 0; i < 16; i++) { | 390 | for (i = 0; i < 16; i++) { |