Re: [PATCH 07/54] KVM: x86: Alert userspace that KVM_SET_CPUID{,2} after KVM_RUN is broken

From: Paolo Bonzini
Date: Wed Jun 23 2021 - 15:53:23 EST


On 23/06/21 21:02, Jim Mattson wrote:

BTW, there is actually a theoretical usecase for KVM_SET_CPUID2 after
KVM_RUN, which is to test OSes against microcode updates that hide,
totally random example, the RTM bit. But it's still not worth keeping
it given 1) the bugs and complications in KVM, 2) if you really wanted
that kind of testing so hard, the fact that you can just create a new
vcpu file descriptor from scratch, possibly in cooperation with
userspace MSR filtering 3) AFAIK no one has done that anyway in 15 years.

Though such a usecase may exist, I don't think it actually works
today. For example, kvm_vcpu_after_set_cpuid() potentially changes the
value of the guest IA32_PERF_GLOBAL_CTRL MSR.

Yep, and that's why I'm okay with actively deprecating KVM_SET_CPUID2 and not just "discouraging" it.

Paolo