On Fri, Sep 22, 2023, Jim Mattson wrote: > On Fri, Sep 22, 2023 at 12:40 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > > > On Fri, Sep 22, 2023, Jim Mattson wrote: > > > Okay. What about the IA32_MISC_ENABLE bits above? > > > > One of the exceptions where I don't see a better option, and hopefully something > > that Intel won't repeat in the future. Though I'm not exactly brimming with > > confidence that Intel won't retroactively add more "gotcha! unsupported!" bits > > in the future when they realize they forgot add a useful CPUID feature bit. > > I don't understand the difference here. Why not make userspace > responsible for setting these bits as well? That probably would have been the ideal approach. I'm not entirely sure it would have actually been feasible though, as I suspect enumerting X86_FEATURE_DS without any kind of guard would break userspace that reflects KVM_GET_SUPPORTED_CPUID back into KVM_SET_CPUID(2). Even better would have been to never merge PEBS support in KVM in its current form. The whole thing is a house of cards, e.g. if counters are "cross-mapped" then the guest counters simply stop working. And those warts aside, the entire enabling was a chaotic mess. See commit 9fc222967a39 ("KVM: x86: Give host userspace full control of MSR_IA32_MISC_ENABLES"). In other words, setting the UNAVAILABLE bits was the least awful way to salvage the mess.