Skip to content

KVM: x86: allow for more CPUID entries

Vitaly Kuznetsov kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 5 repliesIn review

Changes since RFC from the cover letter

- "KVM: x86: disconnect kvm_check_cpuid() from vcpu->arch.cpuid_entries" added to allow running kvm_check_cpuid() before vcpu->arch.cpuid_entries/ vcpu->arch.cpuid_nent are changed [Sean Christopherson]
- Shorten local variable names in kvm_vcpu_ioctl_set_cpuid[,2] [Sean Christopherson]
- Drop unneeded 'out' labels from kvm_vcpu_ioctl_set_cpuid[,2] and return directly whenever possible [Sean Christopherson]

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: x86: disconnect kvm_check_cpuid() from vcpu->arch.cpuid_entriesarch/x86/kvm/cpuid.c+23 -153 replies
2/3KVM: x86: allocate vcpu->arch.cpuid_entries dynamicallyarch/x86/include/asm/kvm_host.h arch/x86/kvm/cpuid.c arch/x86/kvm/x86.c+53 -391 reply
3/3KVM: x86: bump KVM_MAX_CPUID_ENTRIESarch/x86/include/asm/kvm_host.h+1 -11 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMaxim Levitsky
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] KVM: x86: allow for more CPUID entries

Changes since RFC:
- "KVM: x86: disconnect kvm_check_cpuid() from vcpu->arch.cpuid_entries" added to allow running kvm_check_cpuid() before vcpu->arch.cpuid_entries/ vcpu->arch.cpuid_nent are changed [Sean Christopherson]
- Shorten local variable names in kvm_vcpu_ioctl_set_cpuid[,2] [Sean Christopherson]
- Drop unneeded 'out' labels from kvm_vcpu_ioctl_set_cpuid[,2] and return directly whenever possible [Sean Christopherson]

Original description:

With QEMU and newer AMD CPUs (namely: Epyc 'Rome') the current limit for KVM_MAX_CPUID_ENTRIES(80) is reported to be hit. Last time it was raised from '40' in 2010. We can, of course, just bump it a little bit to fix the immediate issue but the report made me wonder why we need to pre- allocate vcpu->arch.cpuid_entries array instead of sizing it dynamically. This RFC is intended to feed my curiosity.

Very mildly tested with selftests/kvm-unit-tests and nothing seems to break. I also don't have access to the system where the original issue was reported but chances we're fixing it are very good IMO as just the second patch alone was reported to be sufficient.

Vitaly Kuznetsov (3):
KVM: x86: disconnect kvm_check_cpuid() from vcpu->arch.cpuid_entries
KVM: x86: allocate vcpu->arch.cpuid_entries dynamically
KVM: x86: bump KVM_MAX_CPUID_ENTRIES

 arch/x86/include/asm/kvm_host.h |   4 +-
 arch/x86/kvm/cpuid.c            | 123 +++++++++++++++++++-------------
 arch/x86/kvm/x86.c              |   1 +
 3 files changed, 75 insertions(+), 53 deletions(-)
Signature · 1 line
2.25.4