The attached patch modifies the NMI handling to do the following (for x86 only): * Allow multiple handlers to be registered and return if they have handled the NMI or not. oprofile and nmi_watchdog are modified to use this. * Modifies the NMI watchdog code to use a function pointer instead of using if statements depending on CPU type. This made the change for the previous item easier. * Moved the "unhandled NMI" code from nmi.c to traps.c, since nmi.c is really the handling for the nmi watchdog, not general nmi handling. * Renames include/linux/nmi.h to include/linux/nmi_watchdog.h and creates a new include/linux/nmi.h for purely NMI handling. This patch used to rename nmi.c to nmi_watchdog.c and create a new nmi.c file that was actually NMI handling. That's probably too big for now, but might be a useful change in the future. I need this because the IPMI watchdog can generate NMIs as a pretimeout, to say "Hey, I'm about to fire the watchdog, do you want to do anything about it?". That way, the watchdog driver can panic thus generating useful information instead of just resetting the processor. I have seen other watchdog timers with this capability, too. And other special-purpose hardware that generates NMIs might find this useful, too. I needed multiple handlers so the NMI watchdog and IPMI watchdog (and other NMI-related things) can peacefully coexist. It is not perfect because the hardware around NMIs sucks so badly, but it does work ok. This code has been available as a patch as part of the IPMI driver for a while, so it has seen some testing. -Corey