[patch-2.4.0-test7-pre3] show_regs() to show cpu number

From: Tigran Aivazian (tigran@veritas.com)
Date: Mon Aug 14 2000 - 10:29:28 EST


Hi Linus,

Using magic sysrq-P request to dump registers to analyze why test7-pre3
doesn't boot didn't make it obvious (on SMP) that it loops in
flush_old_files() because it was switching between that and
default_idle().

If, however show_regs() showed smp_processor_id() it would have been much
more obvious, i.e. I would see flush_old_files() always on the same CPU
and default_idle() on another (instead of thinking that it leaves and
re-enters flush_old_files() thus looping elsewhere).

Therefore, here is the patch that adds printk smp_processor_id() to most
architectures that support it. Tested on SMP/i386 on 2.4.0-test7-pre3.

Regards,
Tigran

diff -urN -X dontdiff linux/arch/alpha/kernel/process.c showreg/arch/alpha/kernel/process.c
--- linux/arch/alpha/kernel/process.c Tue Jul 11 19:26:47 2000
+++ showreg/arch/alpha/kernel/process.c Mon Aug 14 16:16:06 2000
@@ -211,7 +211,8 @@
 void
 show_regs(struct pt_regs * regs)
 {
- printk("\nps: %04lx pc: [<%016lx>]\n", regs->ps, regs->pc);
+ printk("\nCPU: %d\nps: %04lx pc: [<%016lx>]\n",
+ smp_processor_id(), regs->ps, regs->pc);
         printk("rp: [<%016lx>] sp: %p\n", regs->r26, regs+1);
         printk(" r0: %016lx r1: %016lx r2: %016lx r3: %016lx\n",
                regs->r0, regs->r1, regs->r2, regs->r3);
diff -urN -X dontdiff linux/arch/i386/kernel/process.c showreg/arch/i386/kernel/process.c
--- linux/arch/i386/kernel/process.c Tue Jul 11 19:26:47 2000
+++ showreg/arch/i386/kernel/process.c Mon Aug 14 15:52:37 2000
@@ -384,7 +384,7 @@
 {
         unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
 
- printk("\n");
+ printk("\nCPU: %d\n", smp_processor_id());
         printk("EIP: %04x:[<%08lx>]",0xffff & regs->xcs,regs->eip);
         if (regs->xcs & 3)
                 printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
diff -urN -X dontdiff linux/arch/ia64/kernel/process.c showreg/arch/ia64/kernel/process.c
--- linux/arch/ia64/kernel/process.c Mon Aug 14 08:10:58 2000
+++ showreg/arch/ia64/kernel/process.c Mon Aug 14 16:17:31 2000
@@ -68,8 +68,8 @@
 {
         unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
 
- printk("\npsr : %016lx ifs : %016lx ip : [<%016lx>]\n",
- regs->cr_ipsr, regs->cr_ifs, ip);
+ printk("\nCPU: %d\npsr : %016lx ifs : %016lx ip : [<%016lx>]\n",
+ smp_processor_id(), regs->cr_ipsr, regs->cr_ifs, ip);
         printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
                regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
         printk("rnat: %016lx bsps: %016lx pr : %016lx\n",
diff -urN -X dontdiff linux/arch/ppc/kernel/process.c showreg/arch/ppc/kernel/process.c
--- linux/arch/ppc/kernel/process.c Sat Jun 24 12:44:25 2000
+++ showreg/arch/ppc/kernel/process.c Mon Aug 14 16:18:25 2000
@@ -252,6 +252,7 @@
 {
         int i;
 
+ printk("CPU: %d\n", smp_processor_id());
         printk("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx\n",
                regs->nip, regs->xer, regs->link, regs,regs->trap);
         printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
diff -urN -X dontdiff linux/arch/sparc/kernel/process.c showreg/arch/sparc/kernel/process.c
--- linux/arch/sparc/kernel/process.c Fri Jul 14 20:52:15 2000
+++ showreg/arch/sparc/kernel/process.c Mon Aug 14 16:19:32 2000
@@ -268,6 +268,7 @@
 
 void show_regs(struct pt_regs * regs)
 {
+ printk("CPU: %d\n", smp_processor_id());
         printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx\n", regs->psr,
                regs->pc, regs->npc, regs->y);
         printk("g0: %08lx g1: %08lx g2: %08lx g3: %08lx ",

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:37 EST