From: Thomas Gleixner <tglx@linutronix.de>
To: Lai Jiangshan <jiangshanlai@gmail.com>, linux-kernel@vger.kernel.org
Cc: Lai Jiangshan <laijs@linux.alibaba.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
Andi Kleen <ak@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Uros Bizjak <ubizjak@gmail.com>,
Maxim Levitsky <mlevitsk@redhat.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Alexandre Chartre <alexandre.chartre@oracle.com>,
Juergen Gross <jgross@suse.com>, Joerg Roedel <jroedel@suse.de>,
Jian Cai <caij2003@gmail.com>
Subject: Re: [PATCH 2/4] x86/entry: Use asm_noist_exc_nmi() for NMI in early booting stage
Date: Tue, 04 May 2021 14:43:44 +0200 [thread overview]
Message-ID: <87wnseis8v.ffs@nanos.tec.linutronix.de> (raw)
In-Reply-To: <875yzzjxth.ffs@nanos.tec.linutronix.de>
On Mon, May 03 2021 at 23:45, Thomas Gleixner wrote:
> The problem was introduced in 4.14 with b70543a0b2b6 ("x86/idt: Move
> regular trap init to tables").
>
> Before that trap_init() installed an IST gate right away, but looking
> deeper this was broken forever because there is a hen and egg problem.
>
> ISTs only work after TSS is initialized and the ordering here is:
>
> trap_init()
> init_idt()
> cpu_init()
> init_tss()
>
> So the original code had a race window between init_idt() and
> init_tss(). Any IST using exception in that window goes south because
> TSS is not initialized.
>
> b70543a0b2b6 traded the above with that NMI issue. All other
> exceptions are fine...
>
> I'll think about it tomorrow some more...
It does not really matter which way around we do it. Even if we do that
noist dance then still any NMI hitting _before_ init_idt() is going to
lala land. So having this tiny step in between is more or less cosmetic.
And just for completness sake, I don't see a reason why we have to set
up the idt gates _before_ the TSS muck, i.e. before cpu_init().
The only thing cpu_init() needs working which is not installed in the
early_idt is #GP because some cpu init code uses rd/wrmsrl_safe(). But
that's pretty much all of it.
So this wants a proper cleanup and not some paper over it with an extra
step and I don't see a reason why any of this should be backported
simply because it does not matter at all whether the early idt which
only populates a few essential gates is active for a bit longer.
So what we need is a solution for that KVM wreckage but that can be
stand alone.
Thanks,
tglx
next prev parent reply other threads:[~2021-05-04 12:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 23:09 [PATCH 0/4] x86: Don't invoke asm_exc_nmi() on the kernel stack Lai Jiangshan
2021-04-26 23:09 ` [PATCH 1/4] x86/xen/entry: Rename xenpv_exc_nmi to noist_exc_nmi Lai Jiangshan
2021-04-28 21:27 ` Steven Rostedt
2021-04-30 7:15 ` Paolo Bonzini
2021-04-30 12:05 ` Steven Rostedt
2021-05-03 19:05 ` Thomas Gleixner
2021-05-03 19:41 ` Thomas Gleixner
2021-05-10 7:59 ` Juergen Gross
2021-04-26 23:09 ` [PATCH 2/4] x86/entry: Use asm_noist_exc_nmi() for NMI in early booting stage Lai Jiangshan
2021-04-28 21:30 ` Steven Rostedt
2021-05-03 20:13 ` Thomas Gleixner
2021-05-03 20:24 ` Thomas Gleixner
2021-05-03 21:45 ` Thomas Gleixner
2021-05-04 12:43 ` Thomas Gleixner [this message]
2021-05-04 19:50 ` [PATCH] KVM/VMX: Invoke NMI non-IST entry instead of IST entry Thomas Gleixner
2021-05-04 21:05 ` Maxim Levitsky
2021-05-04 21:12 ` Paolo Bonzini
2021-05-04 21:21 ` Sean Christopherson
2021-05-04 21:23 ` Andy Lutomirski
2021-05-04 21:25 ` Paolo Bonzini
2021-05-04 21:51 ` Sean Christopherson
2021-05-04 21:56 ` Paolo Bonzini
2021-05-05 0:00 ` Thomas Gleixner
2021-05-05 15:44 ` Lai Jiangshan
2021-05-05 1:07 ` Lai Jiangshan
2021-05-05 1:11 ` Andy Lutomirski
2021-05-06 12:14 ` [tip: x86/urgent] " tip-bot2 for Lai Jiangshan
2021-04-26 23:09 ` [PATCH 3/4] " Lai Jiangshan
2021-04-30 2:46 ` Lai Jiangshan
2021-05-03 19:37 ` Thomas Gleixner
2021-05-03 20:02 ` Thomas Gleixner
2021-05-04 8:10 ` Paolo Bonzini
2021-04-26 23:09 ` [PATCH 4/4] KVM/VMX: Fold handle_interrupt_nmi_irqoff() into its solo caller Lai Jiangshan
2021-04-30 9:03 ` Thomas Gleixner
2021-04-30 9:06 ` Paolo Bonzini
2021-04-30 23:28 ` Thomas Gleixner
2021-04-30 7:14 ` [PATCH 0/4] x86: Don't invoke asm_exc_nmi() on the kernel stack Paolo Bonzini
2021-05-03 14:36 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wnseis8v.ffs@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=ak@linux.intel.com \
--cc=alexandre.chartre@oracle.com \
--cc=bp@alien8.de \
--cc=caij2003@gmail.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=jiangshanlai@gmail.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=jpoimboe@redhat.com \
--cc=jroedel@suse.de \
--cc=laijs@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=ubizjak@gmail.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox