I've gone over the lkcd and kdb patches in detail and found all places where it looks like there may be problems.
Would some kind soul be able to give me some hints as to how to sort out these merge issues?
Once this is done, I could submit a patch to apply to the lkcd patch in order to get it to apply cleanly to a kernel with kdb already installed.
I'm assuming this is an exercize that others could benefit from too.


Here's a list. I've tried to make it readable. There are 3 questionable merges.

TIA, Bruce.

======================================================

arch/i386/kernel/nmi.c, nmi_watchdog_tick(), I'm assuming this is the correct ordering:

bust_spinlocks(1);
printk("NMI Watchdog detected LOCKUP on CPU%d, eip %08lx, registers:\n", cpu, regs->eip);
show_registers(regs);
printk("console shuts up ...\n");
#ifdef CONFIG_KDB
kdb(KDB_REASON_NMI, 0, regs);
#endif /* CONFIG_KDB */
dump("NMI Watchdog Detected", regs);
console_silent();
spin_unlock(&nmi_print_lock);
bust_spinlocks(0);
do_exit(SIGSEGV);


The default is to place the dump before kdb.

==========================================================

arch/i386/kernel/smp.c, __send_IPI_shortcut(), they both define a similar block, the end result includes both, this one's gotta be wrong.

kdb adds this:---------------------------------------------------------

#ifdef    CONFIG_KDB
   if (vector == KDB_VECTOR) {
       /*
        * Setup KDB IPI to be delivered as an NMI
        */
       cfg = (cfg&~APIC_VECTOR_MASK)|APIC_DM_NMI;
   }
#endif    /* CONFIG_KDB */

lkcd adds this:------------------------------------------------------------

#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
   if (vector == DUMP_VECTOR) {
       /*
        * Setup DUMP IPI to be delivered as an NMI
        */
       cfg = (cfg&~APIC_VECTOR_MASK)|APIC_DM_NMI;
   }
#endif    /* CONFIG_DUMP */

So the resultant function is:-----------------------------------------------

static inline void __send_IPI_shortcut(unsigned int shortcut, int vector)
{
   /*
    * Subtle. In the case of the 'never do double writes' workaround
    * we have to lock out interrupts to be safe.  As we don't care
    * of the value read we use an atomic rmw access to avoid costly
    * cli/sti.  Otherwise we use an even cheaper single atomic write
    * to the APIC.
    */
   unsigned int cfg;

   /*
    * Wait for idle.
    */
   apic_wait_icr_idle();

#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
   if (vector == DUMP_VECTOR) {
       /*
        * Setup DUMP IPI to be delivered as an NMI
        */
       cfg = (cfg&~APIC_VECTOR_MASK)|APIC_DM_NMI;
   }
#endif    /* CONFIG_DUMP */

   /*
    * No need to touch the target chip field
    */
   cfg = __prepare_ICR(shortcut, vector);

#ifdef    CONFIG_KDB
   if (vector == KDB_VECTOR) {
       /*
        * Setup KDB IPI to be delivered as an NMI
        */
       cfg = (cfg&~APIC_VECTOR_MASK)|APIC_DM_NMI;
   }
#endif    /* CONFIG_KDB */

   /*
    * Send the IPI. The write to APIC_ICR fires this off.
    */
   apic_write_around(APIC_ICR, cfg);
}
===================================

arch/i386/kernel/traps.c, I'm not sure the ordering here is correct, the net result is:

asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
{
   unsigned char reason = inb(0x61);

++nmi_count(smp_processor_id());

#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE) ------- from lkcd
       if (dump_ipi(regs)) {
               return;
       }
#endif

#if defined(CONFIG_SMP) && defined(CONFIG_KDB) ------ from kdb
   /*
    * Call the kernel debugger to see if this NMI is due
    * to an KDB requested IPI.  If so, kdb will handle it.
    */
   if (kdb_ipi(regs, do_ack_apic_irq)) {
       return;
   }
#endif    /* defined(CONFIG_SMP) && defined(CONFIG_KDB) */
   if (!(reason & 0xc0)) {
#if CONFIG_X86_LOCAL_APIC

==========================================




Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.

Reply via email to