lkml.org 
[lkml]   [2020]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC V3 6/9] x86/entry: Pass irqentry_state_t by reference
On Fri, Oct 09, 2020 at 12:42:55PM -0700, ira.weiny@intel.com 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.

\
 
 \ /
  Last update: 2020-10-16 13:46    [W:0.372 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site