On Tue, Sep 26, 2023, Sean Christopherson wrote:
There's another related oddity that will be fixed by my approach, assuming the realloc change is also reverted (I missed that in my pasted patch). Userspace *must* do KVM_SET_CPUID{2} in order to load off-by-default state, whereas there is no such requirement for on-by-default state.
Scratch that, KVM explicitly requires KVM_SET_CPUID2 to grant the guest access to off-by-default features, e.g. so that the kernel/KVM doesn't need to context AMX state if it's not exposed to the guest. Thankfully, that has always been true for XFD-based features, i.e. AMX, so it's safe to keep that behavior even though it diverges from on-by-default features.