Blame SOURCES/0015-globally-limit-the-maximum-number-of-CPUs.patch

22c213
From c9c3cf721b0e9e359418f64c2a5121c3f8b5d27a 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
(cherry picked from commit a4ceb63bdc5cbac19f5f633ec761b9de0dedb55e)
22c213
(cherry picked from commit a1f26d85171b4d554225150053700e93ba6eba10)
22c213
22c213
redhat: globally limit the maximum number of CPUs
22c213
22c213
RH-Author: David Hildenbrand <david@redhat.com>
22c213
Message-id: <20180109103253.24517-2-david@redhat.com>
22c213
Patchwork-id: 78531
22c213
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 1/2] redhat: globally limit the maximum number of CPUs
22c213
Bugzilla: 1527449
22c213
RH-Acked-by: David Gibson <dgibson@redhat.com>
22c213
RH-Acked-by: Thomas Huth <thuth@redhat.com>
22c213
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
22c213
22c213
Upstream-status: n/a
22c213
22c213
For RHEL, we support 240, for RHV up to 384 VCPUs. Let's limit this
22c213
globally instead of fixing up all machines. This way, we can easily
22c213
change (increase) the product specific levels later.
22c213
22c213
Signed-off-by: David Hildenbrand <david@redhat.com>
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
22c213
redhat: remove manual max_cpus limitations for ppc
22c213
22c213
RH-Author: David Hildenbrand <david@redhat.com>
22c213
Message-id: <20180109103253.24517-3-david@redhat.com>
22c213
Patchwork-id: 78532
22c213
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 2/2] redhat: remove manual max_cpus limitations for ppc
22c213
Bugzilla: 1527449
22c213
RH-Acked-by: David Gibson <dgibson@redhat.com>
22c213
RH-Acked-by: Thomas Huth <thuth@redhat.com>
22c213
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
22c213
22c213
Upstream-status: n/a
22c213
22c213
RH-Author: Andrew Jones <drjones@redhat.com>
22c213
Message-id: <1390301212-15344-1-git-send-email-drjones@redhat.com>
22c213
Patchwork-id: 56862
22c213
O-Subject: [RHEL7.0 qemu-kvm PATCH v6] use recommended max vcpu count
22c213
Bugzilla: 998708
22c213
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
22c213
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
22c213
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
22c213
22c213
The recommended vcpu max limit (KVM_CAP_NR_VCPUS) should be used instead
22c213
of the actual max vcpu limit (KVM_CAP_MAX_VCPUS) to give an error.
22c213
22c213
This commit matches the limit to current KVM_CAP_NR_VCPUS value.
22c213
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 accel/kvm/kvm-all.c | 12 ++++++++++++
22c213
 vl.c                | 18 ++++++++++++++++++
22c213
 2 files changed, 30 insertions(+)
22c213
22c213
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
22c213
index ca00daa2f5..dc3ed7f04e 100644
22c213
--- a/accel/kvm/kvm-all.c
22c213
+++ b/accel/kvm/kvm-all.c
22c213
@@ -1943,6 +1943,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
diff --git a/vl.c b/vl.c
22c213
index 9f3e7e7733..1550aa2aaa 100644
22c213
--- a/vl.c
22c213
+++ b/vl.c
22c213
@@ -134,6 +134,8 @@ int main(int argc, char **argv)
22c213
 
22c213
 #define MAX_VIRTIO_CONSOLES 1
22c213
 
22c213
+#define RHEL_MAX_CPUS 384
22c213
+
22c213
 static const char *data_dir[16];
22c213
 static int data_dir_idx;
22c213
 const char *bios_name = NULL;
22c213
@@ -1339,6 +1341,20 @@ static MachineClass *find_default_machine(GSList *machines)
22c213
     return NULL;
22c213
 }
22c213
 
22c213
+/* Maximum number of CPUs limited for Red Hat Enterprise Linux */
22c213
+static void limit_max_cpus_in_machines(void)
22c213
+{
22c213
+    GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
22c213
+
22c213
+    for (el = machines; el; el = el->next) {
22c213
+        MachineClass *mc = el->data;
22c213
+
22c213
+        if (mc->max_cpus > RHEL_MAX_CPUS) {
22c213
+            mc->max_cpus = RHEL_MAX_CPUS;
22c213
+        }
22c213
+    }
22c213
+}
22c213
+
22c213
 static int machine_help_func(QemuOpts *opts, MachineState *machine)
22c213
 {
22c213
     ObjectProperty *prop;
22c213
@@ -3857,6 +3873,8 @@ int main(int argc, char **argv, char **envp)
22c213
                      "mutually exclusive");
22c213
         exit(EXIT_FAILURE);
22c213
     }
22c213
+    /* Maximum number of CPUs limited for Red Hat Enterprise Linux */
22c213
+    limit_max_cpus_in_machines();
22c213
 
22c213
     configure_rtc(qemu_find_opts_singleton("rtc"));
22c213
 
22c213
-- 
22c213
2.21.0
22c213