From b0baccfdfb10c34d9f9d35363e098dab7f376fe9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 21 Jan 2014 10:46:52 +0100 Subject: globally limit the maximum number of CPUs We now globally limit the number of VCPUs. Especially, there is no way one can specify more than max_cpus VCPUs for a VM. This allows us the restore the ppc max_cpus limitation to the upstream default and minimize the ppc hack in kvm-all.c. Signed-off-by: David Hildenbrand Signed-off-by: Miroslav Rezanina Signed-off-by: Danilo Cesar Lemes de Paula Rebase notes (2.11.0): - Removed CONFIG_RHV reference - Update commit log Merged patches (2.11.0): - 92fef14623 redhat: remove manual max_cpus limitations for ppc - bb722e9eff redhat: globally limit the maximum number of CPUs - fdeef3c1c7 RHEL: Set vcpus hard limit to 240 for Power - 0584216921 Match POWER max cpus to x86 Signed-off-by: Andrew Jones Merged patches (5.1.0): - redhat: globally limit the maximum number of CPUs - redhat: remove manual max_cpus limitations for ppc - use recommended max vcpu count Merged patches (5.2.0 rc0): - f8a4123 vl: Remove downstream-only MAX_RHEL_CPUS code --- accel/kvm/kvm-all.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index baaa542..a1fbda0 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2108,6 +2108,18 @@ static int kvm_init(MachineState *ms) soft_vcpus_limit = kvm_recommended_vcpus(s); hard_vcpus_limit = kvm_max_vcpus(s); +#ifdef HOST_PPC64 + /* + * On POWER, the kernel advertises a soft limit based on the + * number of CPU threads on the host. We want to allow exceeding + * this for testing purposes, so we don't want to set hard limit + * to soft limit as on x86. + */ +#else + /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */ + hard_vcpus_limit = soft_vcpus_limit; +#endif + while (nc->name) { if (nc->num > soft_vcpus_limit) { warn_report("Number of %s cpus requested (%d) exceeds " -- 1.8.3.1