Re: [RFC] #MC mess

From: Peter Zijlstra
Date: Wed Feb 19 2020 - 03:16:03 EST


On Tue, Feb 18, 2020 at 04:15:57PM -0800, Andy Lutomirski wrote:
> On Tue, Feb 18, 2020 at 9:31 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
> >
> > Ok,
> >
> > so Peter raised this question on IRC today, that the #MC handler needs
> > to disable all kinds of tracing/kprobing and etc exceptions happening
> > while handling an #MC. And I guess we can talk about supporting some
> > exceptions but #MC is usually nasty enough to not care about tracing
> > when former happens.
> >
>
> It's worth noting that MCE is utterly, terminally screwed under high
> load. In particular:
>
> Step 1: NMI (due to perf).
>
> immediately thereafter (before any of the entry asm runs)
>
> Step 2: MCE (due to recoverable memory failure or remote CPU MCE)
>
> Step 3: MCE does its thing and does IRET
>
> Step 4: NMI
>
> We are toast.
>
> Tony, etc, can you ask your Intel contacts who care about this kind of
> thing to stop twiddling their thumbs and FIX IT? The easy fix is
> utterly trivial. Add a new instruction IRET_NON_NMI. It does
> *exactly* the same thing as IRET except that it does not unmask NMIs.
> (It also doesn't unmask NMIs if it faults.) No fancy design work.
> Future improvements can still happen on top of this.

Yes please! Of course, we're stuck with the existing NMI entry crap
forever because legacy, but it would make all things NMI so much saner.