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