On Fri, Feb 25, 2022 at 08:08:19PM +0000, Oliver Upton wrote: > Since commit 03a8871add95 ("KVM: nVMX: Expose load IA32_PERF_GLOBAL_CTRL > VM-{Entry,Exit} control"), KVM has taken ownership of the "load > IA32_PERF_GLOBAL_CTRL" VMX entry/exit control bits. The ABI is that > these bits will be set in the IA32_VMX_TRUE_{ENTRY,EXIT}_CTLS MSRs if > the guest's CPUID exposes a vPMU that supports the IA32_PERF_GLOBAL_CTRL > MSR (CPUID.0AH:EAX[7:0] > 1), and clear otherwise. > > However, KVM will only do so if userspace sets the CPUID before writing > to the corresponding MSRs. Of course, there are no ordering requirements > between these ioctls. Uphold the ABI regardless of ordering by > reapplying KVMs tweaks to the VMX control MSRs after userspace has > written to them. > > Note that older kernels without commit c44d9b34701d ("KVM: x86: Invoke > vendor's vcpu_after_set_cpuid() after all common updates") still require > that the entry/exit controls be updated from kvm_pmu_refresh(). Leave > the benign call in place to allow for cleaner backporting and punt the > cleanup to a later change. > > Uphold the old ABI by reapplying KVM's tweaks to the BNDCFGS bits after > an MSR write from userspace. > typo: s/BNDCFGS/"load IA32_PERF_GLOBAL_CTRL"/ I'll adopt this if I need to send another spin of the series. Otherwise, do you mind fixing the typo when applying Paolo? -- Oliver