Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [patch V5 part 3 12/29] x86/entry/common: Provide idtentry_enter/exit() | Date | Mon, 11 May 2020 20:42:14 +0200 |
| |
Andy Lutomirski <luto@kernel.org> writes: > On Mon, May 11, 2020 at 3:59 AM Thomas Gleixner <tglx@linutronix.de> wrote: >> >> Andy Lutomirski <luto@kernel.org> writes: >> >> + * Invoked by all exception/interrupt IDTENTRY handlers which are not >> >> + * returning through the paranoid exit path (all except NMI, #DF and the IST >> >> + * variants of #MC and #DB). >> > > >> +void noinstr idtentry_exit(struct pt_regs *regs) >> +{ >> + lockdep_assert_irqs_disabled(); >> + >> + if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) >> + WARN_ON_ONCE(!on_thread_stack()); > > Whoops. After sleeping on this, this is obviously wrong. If this is > something like a page fault, we can be on an IST or IRQ stack. > Perhaps the actual condition should be: > > 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.
| |