Re: [patch V6 part 3 12/29] x86/entry/common: Provide idtentry_enter/exit()

Andy Lutomirski
2020-05-14T00:51:25Z

On Tue, May 12, 2020 at 9:50 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> Thomas Gleixner <tglx@linutronix.de> writes:
> > Andy Lutomirski <luto@kernel.org> writes:
> >> WARN_ON_ONCE(!on_thread_stack() && (regs->flags & X86_FLAGS_IF) &&
> >> preempt_count() == 0);
> >>
> >> IOW, the actual condition we want is that, if the idtenter_entry/exit
> >> code might schedule or if a cond_local_irq_enable() path might
> >> schedule, we had better be on the correct stack.
> >>
> >> Sorry for causing confusion.
> >
> > Nothing to be sorry about. I could have thought about it myself :)
> > Let me try again.
>
> Move it into the actual preemption condition. Most natural place.

Nice! This way the logic is clear and the warning will fire even if
no actual preemption occurs.

Acked-by: Andy Lutomirski <luto@kernel.org>