diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2020-10-01 15:05:40 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-10-21 17:36:33 -0400 |
commit | 255cbecfe0c9466ade041fe381dde18a61cca549 (patch) | |
tree | eb014077d77a9a114b3de6f3a12a9da20cd705f8 /arch/x86/kvm/mmu/mmu.c | |
parent | f69858fcc727f8098419f3c595678e671bd2d8b7 (diff) | |
download | lwn-255cbecfe0c9466ade041fe381dde18a61cca549.tar.gz lwn-255cbecfe0c9466ade041fe381dde18a61cca549.zip |
KVM: x86: allocate vcpu->arch.cpuid_entries dynamically
The current limit for guest CPUID leaves (KVM_MAX_CPUID_ENTRIES, 80)
is reported to be insufficient but before we bump it let's switch to
allocating vcpu->arch.cpuid_entries[] array dynamically. Currently,
'struct kvm_cpuid_entry2' is 40 bytes so vcpu->arch.cpuid_entries is
3200 bytes which accounts for 1/4 of the whole 'struct kvm_vcpu_arch'
but having it pre-allocated (for all vCPUs which we also pre-allocate)
gives us no real benefits.
Another plus of the dynamic allocation is that we now do kvm_check_cpuid()
check before we assign anything to vcpu->arch.cpuid_nent/cpuid_entries so
no changes are made in case the check fails.
Opportunistically remove unneeded 'out' labels from
kvm_vcpu_ioctl_set_cpuid()/kvm_vcpu_ioctl_set_cpuid2() and return
directly whenever possible.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20201001130541.1398392-3-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu/mmu.c')
0 files changed, 0 insertions, 0 deletions