KVM: x86: Remove unnecessary caching of KVM's PV CPUID base
authorSean Christopherson <seanjc@google.com>
Thu, 28 Nov 2024 01:34:00 +0000 (17:34 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 18 Dec 2024 22:19:56 +0000 (14:19 -0800)
commita5b32718081e5e2ddec1a1473a0e0f21bc35ed67
tree4ecdf61c21144311f4dc14d54019f50112d68761
parent63d8c702c2d41d070c84d97069a71ade808f8054
KVM: x86: Remove unnecessary caching of KVM's PV CPUID base

Now that KVM only searches for KVM's PV CPUID base when userspace sets
guest CPUID, drop the cache and simply do the search every time.

Practically speaking, this is a nop except for situations where userspace
sets CPUID _after_ running the vCPU, which is anything but a hot path,
e.g. QEMU does so only when hotplugging a vCPU.  And on the flip side,
caching guest CPUID information, especially information that is used to
query/modify _other_ CPUID state, is inherently dangerous as it's all too
easy to use stale information, i.e. KVM should only cache CPUID state when
the performance and/or programming benefits justify it.

Link: https://lore.kernel.org/r/20241128013424.4096668-34-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/cpuid.c