Re: [PATCH 6/6] KVM: Do compatibility checks on hotplugged CPUs
From: Jim Mattson
Date: Wed Jan 12 2022 - 18:01:55 EST
On Wed, Jan 12, 2022 at 9:54 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Tue, Jan 11, 2022, Chao Gao wrote:
> > On Tue, Jan 11, 2022 at 12:46:52AM +0000, Sean Christopherson wrote:
> > >This has a fairly big flaw in that it prevents KVM from creating VMs even if the
> > >offending CPU is offlined. That seems like a very reasonable thing to do, e.g.
> > >admin sees that hotplugging a CPU broke KVM and removes the CPU to remedy the
> > >problem. And if KVM is built-in, reloading KVM to wipe hardware_incompatible
> > >after offlining the CPU isn't an option.
>
> ...
>
> > >That said, I'm not convinced that continuing with the hotplug in this scenario
> > >is ever the right thing to do. Either the CPU being hotplugged really is a different
> > >CPU, or it's literally broken. In both cases, odds are very, very good that running
> > >on the dodgy CPU will hose the kernel sooner or later, i.e. KVM's compatibility checks
> > >are just the canary in the coal mine.
> >
> > Ok. Then here are two options:
> > 1. KVM always prevents incompatible CPUs from being brought up regardless of running VMs
> > 2. make "disabling KVM on incompatible CPUs" an opt-in feature.
> >
> > Which one do you think is better?
>
> IMO, #1. It's simpler to implement and document, and is less likely to surprise
> the user. We can always pivot to #2 _if_ anyone requests the ability to dynamically
> disable KVM in order to bring up heterogenous CPUs and has a reasonable, sane use
> case for doing so. But that's a big "if" as I would be very surprised if it's even
> possible to encounter such a setup without a hardware bug, firmware bug, and/or user
> error.
How quickly we forget the Woodcrest B/G fiasco.