[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrX6p6o0NJszjon7R8Tb+fFa=Jw5=CQQ56yZi+YVggopiQ@mail.gmail.com>
Date: Mon, 11 May 2020 08:31:22 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Andy Lutomirski <luto@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Frederic Weisbecker <frederic@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Joel Fernandes <joel@...lfernandes.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
Brian Gerst <brgerst@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Will Deacon <will@...nel.org>
Subject: Re: [patch V5 part 3 12/29] x86/entry/common: Provide idtentry_enter/exit()
On Mon, May 11, 2020 at 3:59 AM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> Andy Lutomirski <luto@...nel.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.
Powered by blists - more mailing lists