Re: [patch V6 part 3 12/29] x86/entry/common: Provide idtentry_enter/exit()
From: Andy Lutomirski
Date: Wed May 13 2020 - 20:51:25 EST
On Tue, May 12, 2020 at 9:50 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> Thomas Gleixner <tglx@xxxxxxxxxxxxx> writes:
> > Andy Lutomirski <luto@xxxxxxxxxx> 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@xxxxxxxxxx>