[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o8qu5n5l.fsf@nanos.tec.linutronix.de>
Date: Mon, 11 May 2020 20:42:14 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Andy Lutomirski <luto@...nel.org>
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()
Andy Lutomirski <luto@...nel.org> writes:
> 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.
Nothing to be sorry about. I could have thought about it myself :)
Let me try again.
Powered by blists - more mailing lists