On 25 Nov 2002 09:04:45 -0600, 
Todd Inglett <[EMAIL PROTECTED]> wrote:
>On ppc64 hardware (and IBM ppc32 hardware) there is typically a reset
>button that causes a non-maskable reset.  This vectors all cpus into a
>single function.  I would like to code it to trap into kdb when I do
>this.
>
>I have found that kdb doesn't seem to like this with any of the
>currently defined "reasons."  All the processors in this case are going
>to call into kdb at precisely the same time.

The problem with a broadcast NMI is that all processors end up in the
NMI state.  I don't know about ppc, but on x86 and ia64, the processors
will not take another NMI until they exit from the first one.  IOW, the
broadcast NMI stops the kdb NMI from doing anything.  The only solution
is to use KDB_ENTER() on the first cpu that gets the NMI and to drop
back to normal code for all the other cpus.  Code something like this

void
SystemResetException(struct pt_regs *regs)
{
        char *msg = "System Reset in kernel mode.\n";
#ifdef  CONFIG_KDB
        static atomic_t kdb_SystemResetException = ATOMIC_INIT(0);
#endif
        udbg_printf(msg); printk(msg);
        if (fwnmi_active) {
                unsigned long *r3 = __va(regs->gpr[3]); /* for FWNMI debug */
                struct rtas_error_log *errlog;

                msg = "FWNMI is active with save area at %016lx\n";
                udbg_printf(msg, r3); printk(msg, r3);
                errlog = FWNMI_get_errinfo(regs);
        }
#if defined(CONFIG_XMON)
        xmon(regs);
        udbg_printf("leaving xmon...\n");
#endif
#ifdef  CONFIG_KDB
        if (atomic_inc_return(&kdb_SystemResetException) == 1)
                KDB_ENTER();
        atomic_dec(&kdb_SystemResetException);
        return;
#else   /* !CONFIG_KDB */
        for(;;);
#endif  /* !CONFIG_KDB */
}


Reply via email to