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

4a2fec
From bb722e9effd08ea9d64091914c6f09d061017cad Mon Sep 17 00:00:00 2001
4a2fec
From: David Hildenbrand <david@redhat.com>
4a2fec
Date: Tue, 9 Jan 2018 10:32:52 +0100
4a2fec
Subject: [PATCH 02/12] redhat: globally limit the maximum number of CPUs
4a2fec
4a2fec
RH-Author: David Hildenbrand <david@redhat.com>
4a2fec
Message-id: <20180109103253.24517-2-david@redhat.com>
4a2fec
Patchwork-id: 78531
4a2fec
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 1/2] redhat: globally limit the maximum number of CPUs
4a2fec
Bugzilla: 1527449
4a2fec
RH-Acked-by: David Gibson <dgibson@redhat.com>
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
4a2fec
4a2fec
Upstream-status: n/a
4a2fec
4a2fec
For RHEL, we support 240, for RHV up to 384 VCPUs. Let's limit this
4a2fec
globally instead of fixing up all machines. This way, we can easily
4a2fec
change (increase) the product specific levels later.
4a2fec
4a2fec
Signed-off-by: David Hildenbrand <david@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 vl.c | 23 +++++++++++++++++++++++
4a2fec
 1 file changed, 23 insertions(+)
4a2fec
4a2fec
diff --git a/vl.c b/vl.c
4a2fec
index bef5ae3..90b542f 100644
4a2fec
--- a/vl.c
4a2fec
+++ b/vl.c
4a2fec
@@ -135,6 +135,12 @@ int main(int argc, char **argv)
4a2fec
 #define MAX_VIRTIO_CONSOLES 1
4a2fec
 #define MAX_SCLP_CONSOLES 1
4a2fec
 
4a2fec
+#if defined(CONFIG_RHV)
4a2fec
+#define RHEL_MAX_CPUS 384
4a2fec
+#else
4a2fec
+#define RHEL_MAX_CPUS 240
4a2fec
+#endif
4a2fec
+
4a2fec
 static const char *data_dir[16];
4a2fec
 static int data_dir_idx;
4a2fec
 const char *bios_name = NULL;
4a2fec
@@ -1501,6 +1507,20 @@ MachineClass *find_default_machine(void)
4a2fec
     return mc;
4a2fec
 }
4a2fec
 
4a2fec
+/* Maximum number of CPUs limited for Red Hat Enterprise Linux */
4a2fec
+static void limit_max_cpus_in_machines(void)
4a2fec
+{
4a2fec
+    GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
4a2fec
+
4a2fec
+    for (el = machines; el; el = el->next) {
4a2fec
+        MachineClass *mc = el->data;
4a2fec
+
4a2fec
+        if (mc->max_cpus > RHEL_MAX_CPUS) {
4a2fec
+            mc->max_cpus = RHEL_MAX_CPUS;
4a2fec
+        }
4a2fec
+    }
4a2fec
+}
4a2fec
+
4a2fec
 MachineInfoList *qmp_query_machines(Error **errp)
4a2fec
 {
4a2fec
     GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
4a2fec
@@ -4130,6 +4150,9 @@ int main(int argc, char **argv, char **envp)
4a2fec
 
4a2fec
     replay_configure(icount_opts);
4a2fec
 
4a2fec
+    /* Maximum number of CPUs limited for Red Hat Enterprise Linux */
4a2fec
+    limit_max_cpus_in_machines();
4a2fec
+
4a2fec
     machine_class = select_machine();
4a2fec
 
4a2fec
     set_memory_options(&ram_slots, &maxram_size, machine_class);
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec