Re: [PATCH 1/3] KVM: SVM: Check EFER.SVME before updating MSR_VM_CR on guest writes
From: Jim Mattson
Date: Thu Oct 29 2026 - 18:05:26 EST
On Thu, Oct 29, 2026 at 2:52 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Thu, Oct 29, 2026, Jim Mattson wrote:
> > On Thu, Oct 29, 2026 at 2:19 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > >
> > > On Thu, Oct 29, 2026, Jim Mattson wrote:
> > > > (Host- initiated writes are allowed to set any valid MSR_VM_CR bits.)
> > >
> > > Eww. Why? If we allow this, then we'll end up with the mess where the guest
> > > can't write back the current value (if userspace is being weird). I get that
> > > we want to avoid ordering issues, but there's *already* a required order here,
> > > unless userspace ignores the failure from svm_set_vm_cr() and continues on.
> > >
> > > KVM doesn't advertise the MSR as something to be saved/restored, and none of
> > > QEMU, CHV, CrosVM, or our VMM appear to save/restore it. So why make trouble
> > > for ourselves?
> >
> > OMG! I didn't look any farther than the obviously broken svm_set_vm_cr().
> >
> > It looks like svm->nested.vm_cr_msr controls nothing other than itself.
>
> LOL, nice.
>
> > It's just 5 bits of storage with some weird locking rules, and it
> > resets to 0 on suspend/resume.
> >
> > What is the point of such half-baked support?
>
> More than likely, so that older kernels didn't crash when writing an MSR KVM
> didn't emulate. :-(
You're not going to let me get rid of it, are you?