static notrace __kprobes void default_do_nmi(struct pt_regs *regs) { unsigned char reason = 0; int cpu; cpu = smp_processor_id(); /* Only the BSP gets external NMIs from the system. */ if (!cpu) reason = get_nmi_reason(); #if defined(CONFIG_SMP) && defined(CONFIG_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, NULL)) { return; } #endif /* defined(CONFIG_SMP) && defined(CONFIG_KDB) */ if (!(reason & 0xc0)) { if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) == NOTIFY_STOP) return; #ifdef CONFIG_X86_LOCAL_APIC /* * Ok, so this is none of the documented NMI sources, * so it must be the NMI watchdog. */ if (nmi_watchdog_tick(regs, reason)) return; if (!do_nmi_callback(regs, cpu)) unknown_nmi_error(reason, regs); #else unknown_nmi_error(reason, regs); #endif return; } if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) return; /* AK: following checks seem to be broken on modern chipsets. FIXME */ if (reason & 0x80) mem_parity_error(reason, regs); if (reason & 0x40) io_check_error(reason, regs); #ifdef CONFIG_X86_32 /* * Reassert NMI in case it became active meanwhile * as it's edge-triggered: */ reassert_nmi(); #endif }
/* called for each processor.. drop each into kdb. */ void smp_kdb_stop_proc(void) { kdb_ipi(kdb_smp_regs[smp_processor_id()], NULL); }