<did it _have_ to be a macro?>
Doing BUG() inside an NMI should be OK most of the time. But the
BUG-handling code does want to know if we're in interrupt context - at
least for the "fatal exception in interrupt" stuff, and probably other
things.
But afacit the failure to include HARDNMI_MASK in
#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK))
will prevent that.
So.
Should we or should we not make in_interrupt() return true in NMI?
"should", I expect.
If not, we'd need to do something else to communicate the current
processing state down to the BUG-handling code.
--