On Wed, 19 Feb 2020 15:47:25 +0100 Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > Since there are already a number of sites (ARM64, PowerPC) that > effectively nest nmi_enter(), lets make the primitive support this > before adding even more. > > void SMIException(struct pt_regs *regs) > --- a/include/linux/hardirq.h > +++ b/include/linux/hardirq.h > @@ -71,7 +71,7 @@ extern void irq_exit(void); > printk_nmi_enter(); \ > lockdep_off(); \ > ftrace_nmi_enter(); \ > - BUG_ON(in_nmi()); \ > + BUG_ON(in_nmi() == NMI_MASK); \ > preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \ > rcu_nmi_enter(); \ > trace_hardirq_enter(); \ > --- a/include/linux/preempt.h > +++ b/include/linux/preempt.h > @@ -26,13 +26,13 @@ > * PREEMPT_MASK: 0x000000ff > * SOFTIRQ_MASK: 0x0000ff00 > * HARDIRQ_MASK: 0x000f0000 > - * NMI_MASK: 0x00100000 > + * NMI_MASK: 0x00f00000 > * PREEMPT_NEED_RESCHED: 0x80000000 > */ > #define PREEMPT_BITS 8 > #define SOFTIRQ_BITS 8 > #define HARDIRQ_BITS 4 > -#define NMI_BITS 1 > +#define NMI_BITS 4 > Probably should document somewhere (in a comment above nmi_enter()?) that we allow nmi_enter() to nest up to 15 times. -- Steve