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