]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
dump_stack: unify debug information printed by show_regs()
authorTejun Heo <tj@kernel.org>
Tue, 30 Apr 2013 22:27:17 +0000 (15:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 May 2013 00:04:02 +0000 (17:04 -0700)
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>
39 files changed:
arch/alpha/kernel/process.c
arch/arc/kernel/troubleshoot.c
arch/arm/kernel/process.c
arch/arm64/kernel/process.c
arch/avr32/kernel/process.c
arch/blackfin/kernel/trace.c
arch/c6x/kernel/traps.c
arch/cris/arch-v10/kernel/process.c
arch/cris/arch-v32/kernel/process.c
arch/frv/kernel/traps.c
arch/h8300/kernel/process.c
arch/hexagon/kernel/vm_events.c
arch/ia64/kernel/process.c
arch/m32r/kernel/process.c
arch/metag/kernel/process.c
arch/microblaze/kernel/process.c
arch/mips/kernel/traps.c
arch/mn10300/kernel/process.c
arch/openrisc/kernel/process.c
arch/parisc/kernel/traps.c
arch/powerpc/kernel/process.c
arch/s390/kernel/dumpstack.c
arch/score/kernel/traps.c
arch/sh/kernel/process_32.c
arch/sh/kernel/process_64.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/tile/kernel/process.c
arch/um/sys-ppc/sysrq.c
arch/unicore32/kernel/process.c
arch/x86/include/asm/bug.h
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/xtensa/kernel/traps.c
include/linux/printk.h
kernel/printk.c

index a3fd8a29ccac418b7299f9db23452733348e6219..ab80a80d38a214d57d6fa06c2f2e8e601ea0415b 100644 (file)
@@ -175,6 +175,7 @@ machine_power_off(void)
 void
 show_regs(struct pt_regs *regs)
 {
+       show_regs_print_info(KERN_DEFAULT);
        dik_show_regs(regs, NULL);
 }
 
index 7c10873c311fb11c0dfad09e1ad5d8cebd958cfc..96be1e6e76d8ed2697c5f0fbb4e62416e6a87269 100644 (file)
@@ -163,6 +163,7 @@ void show_regs(struct pt_regs *regs)
                return;
 
        print_task_path_n_nm(tsk, buf);
+       show_regs_print_info(KERN_INFO);
 
        if (current->thread.cause_code)
                show_ecr_verbose(regs);
index c9a5e2ce8aa98831d4d498bd4442ebeaecf1b7e6..ae58d3b37d9d546085e67fa257637d016fc10494 100644 (file)
@@ -225,11 +225,8 @@ void __show_regs(struct pt_regs *regs)
        unsigned long flags;
        char buf[64];
 
-       printk("CPU: %d    %s  (%s %.*s)\n",
-               raw_smp_processor_id(), print_tainted(),
-               init_utsname()->release,
-               (int)strcspn(init_utsname()->version, " "),
-               init_utsname()->version);
+       show_regs_print_info(KERN_DEFAULT);
+
        print_symbol("PC is at %s\n", instruction_pointer(regs));
        print_symbol("LR is at %s\n", regs->ARM_lr);
        printk("pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n"
@@ -284,7 +281,6 @@ void __show_regs(struct pt_regs *regs)
 void show_regs(struct pt_regs * regs)
 {
        printk("\n");
-       printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
        __show_regs(regs);
        dump_stack();
 }
index 6f3822f98dcd5f8b198c4c777884a17b2deb5e85..f4919721f7dde20ea0fabb3369395c2359b7cc34 100644 (file)
@@ -145,11 +145,7 @@ void __show_regs(struct pt_regs *regs)
 {
        int i;
 
-       printk("CPU: %d    %s  (%s %.*s)\n",
-               raw_smp_processor_id(), print_tainted(),
-               init_utsname()->release,
-               (int)strcspn(init_utsname()->version, " "),
-               init_utsname()->version);
+       show_regs_print_info(KERN_DEFAULT);
        print_symbol("PC is at %s\n", instruction_pointer(regs));
        print_symbol("LR is at %s\n", regs->regs[30]);
        printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n",
@@ -166,7 +162,6 @@ void __show_regs(struct pt_regs *regs)
 void show_regs(struct pt_regs * regs)
 {
        printk("\n");
-       printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
        __show_regs(regs);
 }
 
index 89a8017e8ca6939b2252c0e68be94989e7e1424b..e7b61494c312e7a4683f11707b2a7ff8a32f6e3b 100644 (file)
@@ -215,6 +215,8 @@ void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl)
        unsigned long lr = regs->lr;
        unsigned long mode = (regs->sr & MODE_MASK) >> MODE_SHIFT;
 
+       show_regs_print_info(log_lvl);
+
        if (!user_mode(regs)) {
                sp = (unsigned long)regs + FRAME_SIZE_FULL;
 
@@ -252,9 +254,6 @@ void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl)
               regs->sr & SR_I0M ? '0' : '.',
               regs->sr & SR_GM ? 'G' : 'g');
        printk("%sCPU Mode: %s\n", log_lvl, cpu_modes[mode]);
-       printk("%sProcess: %s [%d] (task: %p thread: %p)\n",
-              log_lvl, current->comm, current->pid, current,
-              task_thread_info(current));
 }
 
 void show_regs(struct pt_regs *regs)
index f7f7a18abca915773ad291bd74a8ef192ffde333..c36efa0c7163c4dac53515ceb822154e559dd698 100644 (file)
@@ -853,6 +853,8 @@ void show_regs(struct pt_regs *fp)
        unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
 
        pr_notice("\n");
+       show_regs_print_info(KERN_NOTICE);
+
        if (CPUID != bfin_cpuid())
                pr_notice("Compiled for cpu family 0x%04x (Rev %d), "
                        "but running on:0x%04x (Rev %d)\n",
index d0b96ef25c17d463a1ca8f29412b410259acbf3a..dcc2c2f6d67c8d24efd5d07ebaf54a4ee9510d55 100644 (file)
@@ -31,6 +31,7 @@ void __init trap_init(void)
 void show_regs(struct pt_regs *regs)
 {
        pr_err("\n");
+       show_regs_print_info(KERN_ERR);
        pr_err("PC: %08lx SP: %08lx\n", regs->pc, regs->sp);
        pr_err("Status: %08lx ORIG_A4: %08lx\n", regs->csr, regs->orig_a4);
        pr_err("A0: %08lx  B0: %08lx\n", regs->a0, regs->b0);
index 2ba23c13df683db209e04a4b46df0638cff04d37..753e9a03cf870565bb4ba0619a3b529e1b9a430d 100644 (file)
@@ -176,6 +176,9 @@ unsigned long get_wchan(struct task_struct *p)
 void show_regs(struct pt_regs * regs)
 {
        unsigned long usp = rdusp();
+
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
               regs->irp, regs->srp, regs->dccr, usp, regs->mof );
        printk(" r0: %08lx  r1: %08lx   r2: %08lx  r3: %08lx\n",
index 57451faa9b20edb9bc98fd57e0b156308d33d693..cebd32e2a8fb912b01c007de6756d5f129a52ca9 100644 (file)
@@ -164,6 +164,9 @@ get_wchan(struct task_struct *p)
 void show_regs(struct pt_regs * regs)
 {
        unsigned long usp = rdusp();
+
+       show_regs_print_info(KERN_DEFAULT);
+
         printk("ERP: %08lx SRP: %08lx  CCS: %08lx USP: %08lx MOF: %08lx\n",
                regs->erp, regs->srp, regs->ccs, usp, regs->mof);
 
index cfcd802d6f9ce5c9ade07062075e0bd9420fce4b..4bff48c19d29733e90d75cbad1d631f3cadc3aaf 100644 (file)
@@ -497,6 +497,7 @@ void show_regs(struct pt_regs *regs)
        int loop;
 
        printk("\n");
+       show_regs_print_info(KERN_DEFAULT);
 
        printk("Frame: @%08lx [%s]\n",
               (unsigned long) regs,
@@ -511,8 +512,6 @@ void show_regs(struct pt_regs *regs)
                else
                        printk(" | ");
        }
-
-       printk("Process %s (pid: %d)\n", current->comm, current->pid);
 }
 
 void die_if_kernel(const char *str, ...)
index a17d2cd463d24a47e4ebce22d4fbb33b2168c8e7..1a744ab7e7e5684c13d262caab0a8481b536f47e 100644 (file)
@@ -83,6 +83,8 @@ void machine_power_off(void)
 
 void show_regs(struct pt_regs * regs)
 {
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("\nPC: %08lx  Status: %02x",
               regs->pc, regs->ccr);
        printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx",
index 9b5a4a295a68ba1afbec0f636c58ed072e02a013..f337281ebe67aab12bd4d31a34d0f46e1c061f88 100644 (file)
@@ -33,6 +33,8 @@
  */
 void show_regs(struct pt_regs *regs)
 {
+       show_regs_print_info(KERN_EMERG);
+
        printk(KERN_EMERG "restart_r0: \t0x%08lx   syscall_nr: %ld\n",
               regs->restart_r0, regs->syscall_nr);
        printk(KERN_EMERG "preds: \t\t0x%08lx\n", regs->preds);
index 182bd64cc726851c311b9358cc7496313b7a2fb9..55d4ba47a907acd766541c9b8f1106dbae49dba3 100644 (file)
@@ -101,8 +101,8 @@ show_regs (struct pt_regs *regs)
        unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
 
        print_modules();
-       printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
-                       smp_processor_id(), current->comm);
+       printk("\n");
+       show_regs_print_info(KERN_DEFAULT);
        printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s (%s)\n",
               regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
               init_utsname()->release);
index e2d049018c3bac8ae81ef216a6d8273ba2069f24..e69221d581d54d6fbe8283cc1eddb4c31a39399e 100644 (file)
@@ -73,6 +73,8 @@ void machine_power_off(void)
 void show_regs(struct pt_regs * regs)
 {
        printk("\n");
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \
          regs->bpc, regs->psw, regs->lr, regs->fp);
        printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \
index dc59235445606283ed6e59a809fabfa1e8d33dea..483dff986a23ebdb9e4b762dbf84254e1e715041 100644 (file)
@@ -129,6 +129,8 @@ void show_regs(struct pt_regs *regs)
                "D1.7 "
        };
 
+       show_regs_print_info(KERN_INFO);
+
        pr_info(" pt_regs @ %p\n", regs);
        pr_info(" SaveMask = 0x%04hx\n", regs->ctx.SaveMask);
        pr_info(" Flags = 0x%04hx (%c%c%c%c)\n", regs->ctx.Flags,
index 7cce2e9c171992e52656717c6b5908464c90608d..a55893807274cf6964f8a3ffe683b7dfb20e5dcf 100644 (file)
@@ -20,6 +20,8 @@
 
 void show_regs(struct pt_regs *regs)
 {
+       show_regs_print_info(KERN_INFO);
+
        pr_info(" Registers dump: mode=%X\r\n", regs->pt_mode);
        pr_info(" r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n",
                                regs->r1, regs->r2, regs->r3, regs->r4);
index b512b28cf786b981ca6715b2e5bcc2526dbb5f12..25225515451f8f348d4f2ffa91a4c64c9b004a82 100644 (file)
@@ -231,7 +231,7 @@ static void __show_regs(const struct pt_regs *regs)
        unsigned int cause = regs->cp0_cause;
        int i;
 
-       printk("Cpu %d\n", smp_processor_id());
+       show_regs_print_info(KERN_DEFAULT);
 
        /*
         * Saved main processor registers
index 2da39fb8b3b211351b7a4b402ebf7c4796d035d8..3707da583d0508a3089d2dcf9ec9cd2bca9ed405 100644 (file)
@@ -97,6 +97,7 @@ void machine_power_off(void)
 
 void show_regs(struct pt_regs *regs)
 {
+       show_regs_print_info(KERN_DEFAULT);
 }
 
 /*
index 00c233bf0d0626f82e5f03eecd6e2e14659a4d49..386af258591dbe7084867f88b79c3eef980ce15b 100644 (file)
@@ -90,6 +90,7 @@ void show_regs(struct pt_regs *regs)
 {
        extern void show_registers(struct pt_regs *regs);
 
+       show_regs_print_info(KERN_DEFAULT);
        /* __PHX__ cleanup this mess */
        show_registers(regs);
 }
index e64cf5f09b626fa98f3eddb687c36f97a171a8c5..f702bff0bed9de6c6d5485e7f8ddc87a0ad76490 100644 (file)
@@ -126,6 +126,8 @@ void show_regs(struct pt_regs *regs)
        user = user_mode(regs);
        level = user ? KERN_DEBUG : KERN_CRIT;
 
+       show_regs_print_info(level);
+
        print_gr(level, regs);
 
        for (i = 0; i < 8; i += 4)
index 624d44bb44dc111ba10e4df3170ab8a02ba07d7d..13a8d9d0b5cbd9d098861725e28607cfb7c36515 100644 (file)
@@ -831,6 +831,8 @@ void show_regs(struct pt_regs * regs)
 {
        int i, trap;
 
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
               regs->nip, regs->link, regs->ctr);
        printk("REGS: %p TRAP: %04lx   %s  (%s)\n",
@@ -850,12 +852,6 @@ void show_regs(struct pt_regs * regs)
 #else
                printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr);
 #endif
-       printk("TASK = %p[%d] '%s' THREAD: %p",
-              current, task_pid_nr(current), current->comm, task_thread_info(current));
-
-#ifdef CONFIG_SMP
-       printk(" CPU: %d", raw_smp_processor_id());
-#endif /* CONFIG_SMP */
 
        for (i = 0;  i < 32;  i++) {
                if ((i % REGS_PER_LINE) == 0)
index 2f1f639d1a3dbe33b7eaad64ebd127f78d291e77..298297477257fa86814da0b9599b382bb3ff46ea 100644 (file)
@@ -166,14 +166,7 @@ void show_registers(struct pt_regs *regs)
 
 void show_regs(struct pt_regs *regs)
 {
-       printk("CPU: %d %s %s %.*s\n",
-              task_thread_info(current)->cpu, print_tainted(),
-              init_utsname()->release,
-              (int)strcspn(init_utsname()->version, " "),
-              init_utsname()->version);
-       printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
-              current->comm, current->pid, current,
-              (void *) current->thread.ksp);
+       show_regs_print_info(KERN_DEFAULT);
        show_registers(regs);
        /* Show stack backtrace if pt_regs is from kernel mode */
        if (!user_mode(regs))
index a38f435fba7b7b0a923fc4c2042e1da4444e2522..1517a7dcd6d92a3e49ec9f847456de3156267bfe 100644 (file)
@@ -117,6 +117,8 @@ static void show_code(unsigned int *pc)
  */
 void show_regs(struct pt_regs *regs)
 {
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("r0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
                regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3],
                regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]);
index 73eb66fc6253d4f2361252056d982bc3b33f4417..ebd3933005b46b0cb773e7274c459290889bfc87 100644 (file)
 void show_regs(struct pt_regs * regs)
 {
        printk("\n");
-       printk("Pid : %d, Comm: \t\t%s\n", task_pid_nr(current), current->comm);
-       printk("CPU : %d        \t\t%s  (%s %.*s)\n\n",
-              smp_processor_id(), print_tainted(), init_utsname()->release,
-              (int)strcspn(init_utsname()->version, " "),
-              init_utsname()->version);
+       show_regs_print_info(KERN_DEFAULT);
 
        print_symbol("PC is at %s\n", instruction_pointer(regs));
        print_symbol("PR is at %s\n", regs->pr);
index e611c85144b1753b3871c125a0ed9d5ee1498900..174d124b419e792f936773ef8e29373154f01cba 100644 (file)
@@ -40,6 +40,7 @@ void show_regs(struct pt_regs *regs)
        unsigned long long ah, al, bh, bl, ch, cl;
 
        printk("\n");
+       show_regs_print_info(KERN_DEFAULT);
 
        ah = (regs->pc) >> 32;
        al = (regs->pc) & 0xffffffff;
index dccf5f58d70f76e35e78ce5c6c7ca8c1809c2990..fdd819dfdacf2057474d6e09f590d7617eaf9cb2 100644 (file)
@@ -112,6 +112,8 @@ void show_regs(struct pt_regs *r)
 {
        struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14];
 
+       show_regs_print_info(KERN_DEFAULT);
+
         printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx    %s\n",
               r->psr, r->pc, r->npc, r->y, print_tainted());
        printk("PC: <%pS>\n", (void *) r->pc);
index 9fbf0d14a361e3a8e4702b01eb0c09492168fc55..c6dc1ba069caf8500efb2b1e6e66dd5c3d37050b 100644 (file)
@@ -163,6 +163,8 @@ static void show_regwindow(struct pt_regs *regs)
 
 void show_regs(struct pt_regs *regs)
 {
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x    %s\n", regs->tstate,
               regs->tpc, regs->tnpc, regs->y, print_tainted());
        printk("TPC: <%pS>\n", (void *) regs->tpc);
index 80b2a18deb87a958c07b7c689dcb710b07de4ad3..8ac304484f988a685118d4d4475b48cee1156060 100644 (file)
@@ -573,8 +573,7 @@ void show_regs(struct pt_regs *regs)
        int i;
 
        pr_err("\n");
-       pr_err(" Pid: %d, comm: %20s, CPU: %d\n",
-              tsk->pid, tsk->comm, smp_processor_id());
+       show_regs_print_info(KERN_ERR);
 #ifdef __tilegx__
        for (i = 0; i < 51; i += 3)
                pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n",
index f889449f9285177bb800e1d68ea520fc9f54d089..1ff1ad7f27da41a59b648abd374a6a6b6a8f51f4 100644 (file)
@@ -11,6 +11,8 @@
 void show_regs(struct pt_regs_subarch *regs)
 {
        printk("\n");
+       show_regs_print_info(KERN_DEFAULT);
+
        printk("show_regs(): insert regs here.\n");
 #if 0
         printk("\n");
index 7fab86d7c5d4aa9135cd5d6cffc08f97349fef3c..c9447691bdac9a72563803a6f0816e415c14e4d6 100644 (file)
@@ -144,11 +144,7 @@ void __show_regs(struct pt_regs *regs)
        unsigned long flags;
        char buf[64];
 
-       printk(KERN_DEFAULT "CPU: %d    %s  (%s %.*s)\n",
-               raw_smp_processor_id(), print_tainted(),
-               init_utsname()->release,
-               (int)strcspn(init_utsname()->version, " "),
-               init_utsname()->version);
+       show_regs_print_info(KERN_DEFAULT);
        print_symbol("PC is at %s\n", instruction_pointer(regs));
        print_symbol("LR is at %s\n", regs->UCreg_lr);
        printk(KERN_DEFAULT "pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n"
index 11e1152222d04a18f04803c16826c6bcd0761bd4..2f03ff018d36ce5291e513b9e37e5f81c54e2eb8 100644 (file)
@@ -37,7 +37,4 @@ do {                                                          \
 
 #include <asm-generic/bug.h>
 
-
-extern void show_regs_common(void);
-
 #endif /* _ASM_X86_BUG_H */
index 1038a417ea531f18fcfeacddd589440989a2a1d0..f2a1770ca176381b843f9ab6f08327e55a9a3d6c 100644 (file)
@@ -86,11 +86,9 @@ void show_regs(struct pt_regs *regs)
 {
        int i;
 
+       show_regs_print_info(KERN_EMERG);
        __show_regs(regs, !user_mode_vm(regs));
 
-       pr_emerg("Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n",
-                TASK_COMM_LEN, current->comm, task_pid_nr(current),
-                current_thread_info(), current, task_thread_info(current));
        /*
         * When in-kernel, we also print out the stack and code at the
         * time of the fault..
index b653675d5288476c2f864772fa63e4739f9de06f..addb207dab92d11ebe4d48650babe07db36a1539 100644 (file)
@@ -249,14 +249,10 @@ void show_regs(struct pt_regs *regs)
 {
        int i;
        unsigned long sp;
-       const int cpu = smp_processor_id();
-       struct task_struct *cur = current;
 
        sp = regs->sp;
-       printk("CPU %d ", cpu);
+       show_regs_print_info(KERN_DEFAULT);
        __show_regs(regs, 1);
-       printk(KERN_DEFAULT "Process %s (pid: %d, threadinfo %p, task %p)\n",
-              cur->comm, cur->pid, task_thread_info(cur), cur);
 
        /*
         * When in-kernel, we also print out the stack and code at the
index 14fcf55a5c5b7c0ac5257050ac2e7b679dfff78f..607af0d4d5ef5f34afc0d5e7caad375dafff6663 100644 (file)
@@ -121,30 +121,6 @@ void exit_thread(void)
        drop_fpu(me);
 }
 
-void show_regs_common(void)
-{
-       const char *vendor, *product, *board;
-
-       vendor = dmi_get_system_info(DMI_SYS_VENDOR);
-       if (!vendor)
-               vendor = "";
-       product = dmi_get_system_info(DMI_PRODUCT_NAME);
-       if (!product)
-               product = "";
-
-       /* Board Name is optional */
-       board = dmi_get_system_info(DMI_BOARD_NAME);
-
-       printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
-              current->pid, current->comm, print_tainted(),
-              init_utsname()->release,
-              (int)strcspn(init_utsname()->version, " "),
-              init_utsname()->version,
-              vendor, product,
-              board ? "/" : "",
-              board ? board : "");
-}
-
 void flush_thread(void)
 {
        struct task_struct *tsk = current;
index b5a8905785e6121bf23527466a25d42328e72a86..7305f7dfc7abe7ef46875a9028556de99f73e79e 100644 (file)
@@ -84,8 +84,6 @@ void __show_regs(struct pt_regs *regs, int all)
                savesegment(gs, gs);
        }
 
-       show_regs_common();
-
        printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
                        (u16)regs->cs, regs->ip, regs->flags,
                        smp_processor_id());
index 0f49677da51e62afe9b14f6967ded036e098a578..355ae06dbf94f4fb6de52a126a73f2570a8dad72 100644 (file)
@@ -62,7 +62,6 @@ void __show_regs(struct pt_regs *regs, int all)
        unsigned int fsindex, gsindex;
        unsigned int ds, cs, es;
 
-       show_regs_common();
        printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
        printk_address(regs->ip, 1);
        printk(KERN_DEFAULT "RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss,
index 384b7c7c2f6da38838c254b5e4a11a2767cee13b..458186dab5dcd40c777c5dd59d0784a78e4b3893 100644 (file)
@@ -383,6 +383,8 @@ void show_regs(struct pt_regs * regs)
 {
        int i, wmask;
 
+       show_regs_print_info(KERN_DEFAULT);
+
        wmask = regs->wmask & ~1;
 
        for (i = 0; i < 16; i++) {
index 47827c0a034d4758dd6721e86258d7532811d267..6af944ab38f05638e7443122abbc1ec5592dfcbe 100644 (file)
@@ -147,6 +147,7 @@ void log_buf_kexec_setup(void);
 void __init setup_log_buf(int early);
 void dump_stack_set_arch_desc(const char *fmt, ...);
 void dump_stack_print_info(const char *log_lvl);
+void show_regs_print_info(const char *log_lvl);
 #else
 static inline __printf(1, 0)
 int vprintk(const char *s, va_list args)
@@ -192,6 +193,10 @@ static inline void dump_stack_set_arch_desc(const char *fmt, ...)
 static inline void dump_stack_print_info(const char *log_lvl)
 {
 }
+
+static inline void show_regs_print_info(const char *log_lvl)
+{
+}
 #endif
 
 extern void dump_stack(void) __cold;
index 73a96def4804294584129041c4fc47541d64ec50..e10ad515901f60d763484c1b75049e79ed184c9f 100644 (file)
@@ -2893,4 +2893,20 @@ void dump_stack_print_info(const char *log_lvl)
                       log_lvl, dump_stack_arch_desc_str);
 }
 
+/**
+ * show_regs_print_info - print generic debug info for show_regs()
+ * @log_lvl: log level
+ *
+ * show_regs() implementations can use this function to print out generic
+ * debug information.
+ */
+void show_regs_print_info(const char *log_lvl)
+{
+       dump_stack_print_info(log_lvl);
+
+       printk("%stask: %p ti: %p task.ti: %p\n",
+              log_lvl, current, current_thread_info(),
+              task_thread_info(current));
+}
+
 #endif