Introduce CONFIG_KVM_ARM_MAX_VCPUS which defines the maximum number of supported virtual CPUs per VMs on KVM/ARM. We don't want this number to be arbitrarily large as it will take up a large amount of allocated VCPU space for the VGIC structures for each VM. On the other hand we want to run decent SMP VMs, and even 4 cores was until recently quite a lot on an ARM machine, but this number is growing and for stress testing purposes we want kernels that support more than 4 cpus, thus base the limit on a config option. Dynamically allocating the VGIC structures based on the number of VCPUS will make the code even more difficult to read and understand. Signed-off-by: Christoffer Dall <c.dall@xxxxxxxxxxxxxxxxxxxxxx> --- arch/arm/include/asm/kvm_host.h | 2 +- arch/arm/kvm/Kconfig | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 7127fe7..6c1c6fc 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -25,7 +25,7 @@ #include <asm/kvm_vgic.h> #include <asm/kvm_arch_timer.h> -#define KVM_MAX_VCPUS NR_CPUS +#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS #define KVM_MEMORY_SLOTS 32 #define KVM_PRIVATE_MEM_SLOTS 4 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index ade2673..eaecb9f 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -40,6 +40,17 @@ config KVM_ARM_HOST ---help--- Provides host support for ARM processors. +config KVM_ARM_MAX_VCPUS + int "Number maximum supported virtual CPUs per VM" + depends on KVM_ARM_HOST + default 4 + help + Static number of max supported virtual CPUs per VM. + + If you choose a high number, the vcpu structures will be quite + large, so only choose a reasonable number that you expect to + actually use. + config KVM_ARM_VGIC bool "KVM support for Virtual GIC" depends on KVM_ARM_HOST && OF _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm