Messages in this thread Patch in this message | | | Date | Fri, 8 Aug 2008 07:19:02 -0600 (MDT) | Subject | Re: [ANNOUNCE] Merkey's Kernel Debugger | From | jmerkey@wolfmoun ... |
| |
>> In a partitioned system [I work for SGI, so I'm talking about an Altix], >> there is memory sharing among multiple single-system images. And if >> one of those partitions were to panic the other partitions need to >> be informed that they cannot address the panic'd partition's memory. >> (Once that partition is rebooted any such access will cause an MCA >> in the accessor.) > > There are already existing shutdown hooks. Aren't they good enough > for that? > > I would feel uneasy about having arbitary drivers hook into panic(). > While I'm sure your code is great there is unfortunately a lot > of crappy driver code around. > > -Andi >
I hooked panic last night and inserted a notify_die hook -- there is even a state defined for it already -- DIE_PANIC. The rest of the code should be ok. My only question was where to harvest the regs variable since panic is not a real exception.
Here's a first stab. You also must add #include <linux/kdebug.h> to the top of panic as well.
diff -Naur linux-2.6.27/kernel/panic.c linux-2.6.27-mdb/kernel/panic.c --- linux-2.6.27/kernel/panic.c 2008-08-07 15:32:29.000000000 -0600 +++ linux-2.6.27-mdb/kernel/panic.c 2008-08-07 15:29:09.000000000 -0600 @@ -82,6 +82,12 @@ printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); bust_spinlocks(0);
+ // call the notify_die handler for any resident debuggers which + // may be active and pass the message string. On a software + // fault return at least some sort of regs for a remote debugger + // to look at. + notify_die(DIE_PANIC, buf, get_irq_regs(), 0, 0, 0); + /* * If we have crashed and we have a crash kernel loaded let it handle * everything else.
Jeff
| |