On Fri, Oct 09, 2020 at 12:42:55PM -0700, [email protected] wrote:
> -noinstr bool idtentry_enter_nmi(struct pt_regs *regs)
> +noinstr void idtentry_enter_nmi(struct pt_regs *regs, irqentry_state_t 
> *irq_state)
>  {
> -     bool irq_state = lockdep_hardirqs_enabled();
> +     irq_state->exit_rcu = lockdep_hardirqs_enabled();
>  
>       __nmi_enter();
>       lockdep_hardirqs_off(CALLER_ADDR0);
> @@ -222,15 +222,13 @@ noinstr bool idtentry_enter_nmi(struct pt_regs *regs)
>       trace_hardirqs_off_finish();
>       ftrace_nmi_enter();
>       instrumentation_end();
> -
> -     return irq_state;
>  }
>  
> -noinstr void idtentry_exit_nmi(struct pt_regs *regs, bool restore)
> +noinstr void idtentry_exit_nmi(struct pt_regs *regs, irqentry_state_t 
> *irq_state)
>  {
>       instrumentation_begin();
>       ftrace_nmi_exit();
> -     if (restore) {
> +     if (irq_state->exit_rcu) {
>               trace_hardirqs_on_prepare();
>               lockdep_hardirqs_on_prepare(CALLER_ADDR0);
>       }
> @@ -238,7 +236,7 @@ noinstr void idtentry_exit_nmi(struct pt_regs *regs, bool 
> restore)
>  
>       rcu_nmi_exit();
>       lockdep_hardirq_exit();
> -     if (restore)
> +     if (irq_state->exit_rcu)
>               lockdep_hardirqs_on(CALLER_ADDR0);
>       __nmi_exit();
>  }

That's not nice.. The NMI path is different from the IRQ path and has a
different variable. Yes, this works, but *groan*.

Maybe union them if you want to avoid bloating the structure, but the
above makes it really hard to read.

Reply via email to