cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
26ba25
From 9324eac6e41aa7667042e117dc3581859cecbf5f Mon Sep 17 00:00:00 2001
26ba25
From: Andrew Jones <drjones@redhat.com>
26ba25
Date: Tue, 21 Jan 2014 10:46:52 +0100
26ba25
Subject: globally limit the maximum number of CPUs
26ba25
26ba25
We now globally limit the number of VCPUs.
26ba25
Especially, there is no way one can specify more than
26ba25
max_cpus VCPUs for a VM.
26ba25
26ba25
This allows us the restore the ppc max_cpus limitation to the upstream
26ba25
default and minimize the ppc hack in kvm-all.c.
26ba25
26ba25
Signed-off-by: David Hildenbrand <david@redhat.com>
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
Signed-off-by: Danilo Cesar Lemes de Paula <ddepaula@redhat.com>
26ba25
26ba25
Rebase notes (2.11.0):
26ba25
- Removed CONFIG_RHV reference
26ba25
- Update commit log
26ba25
26ba25
Merged patches (2.11.0):
26ba25
- 92fef14623 redhat: remove manual max_cpus limitations for ppc
26ba25
- bb722e9eff redhat: globally limit the maximum number of CPUs
26ba25
- fdeef3c1c7 RHEL: Set vcpus hard limit to 240 for Power
26ba25
- 0584216921 Match POWER max cpus to x86
26ba25
26ba25
Signed-off-by: Andrew Jones <drjones@redhat.com>
26ba25
(cherry picked from commit a4ceb63bdc5cbac19f5f633ec761b9de0dedb55e)
26ba25
(cherry picked from commit a1f26d85171b4d554225150053700e93ba6eba10)
26ba25
26ba25
redhat: globally limit the maximum number of CPUs
26ba25
26ba25
RH-Author: David Hildenbrand <david@redhat.com>
26ba25
Message-id: <20180109103253.24517-2-david@redhat.com>
26ba25
Patchwork-id: 78531
26ba25
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 1/2] redhat: globally limit the maximum number of CPUs
26ba25
Bugzilla: 1527449
26ba25
RH-Acked-by: David Gibson <dgibson@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
26ba25
26ba25
Upstream-status: n/a
26ba25
26ba25
For RHEL, we support 240, for RHV up to 384 VCPUs. Let's limit this
26ba25
globally instead of fixing up all machines. This way, we can easily
26ba25
change (increase) the product specific levels later.
26ba25
26ba25
Signed-off-by: David Hildenbrand <david@redhat.com>
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
26ba25
redhat: remove manual max_cpus limitations for ppc
26ba25
26ba25
RH-Author: David Hildenbrand <david@redhat.com>
26ba25
Message-id: <20180109103253.24517-3-david@redhat.com>
26ba25
Patchwork-id: 78532
26ba25
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v2 2/2] redhat: remove manual max_cpus limitations for ppc
26ba25
Bugzilla: 1527449
26ba25
RH-Acked-by: David Gibson <dgibson@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
26ba25
26ba25
Upstream-status: n/a
26ba25
26ba25
RH-Author: Andrew Jones <drjones@redhat.com>
26ba25
Message-id: <1390301212-15344-1-git-send-email-drjones@redhat.com>
26ba25
Patchwork-id: 56862
26ba25
O-Subject: [RHEL7.0 qemu-kvm PATCH v6] use recommended max vcpu count
26ba25
Bugzilla: 998708
26ba25
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
26ba25
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
26ba25
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
26ba25
26ba25
The recommended vcpu max limit (KVM_CAP_NR_VCPUS) should be used instead
26ba25
of the actual max vcpu limit (KVM_CAP_MAX_VCPUS) to give an error.
26ba25
26ba25
This commit matches the limit to current KVM_CAP_NR_VCPUS value.
26ba25
---
26ba25
 accel/kvm/kvm-all.c | 12 ++++++++++++
26ba25
 vl.c                | 19 +++++++++++++++++++
26ba25
 2 files changed, 31 insertions(+)
26ba25
26ba25
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
26ba25
index ffee68e..3f1c06e 100644
26ba25
--- a/accel/kvm/kvm-all.c
26ba25
+++ b/accel/kvm/kvm-all.c
26ba25
@@ -1587,6 +1587,18 @@ static int kvm_init(MachineState *ms)
26ba25
     soft_vcpus_limit = kvm_recommended_vcpus(s);
26ba25
     hard_vcpus_limit = kvm_max_vcpus(s);
26ba25
 
26ba25
+#ifdef HOST_PPC64
26ba25
+    /*
26ba25
+     * On POWER, the kernel advertises a soft limit based on the
26ba25
+     * number of CPU threads on the host.  We want to allow exceeding
26ba25
+     * this for testing purposes, so we don't want to set hard limit
26ba25
+     * to soft limit as on x86.
26ba25
+     */
26ba25
+#else
26ba25
+    /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */
26ba25
+    hard_vcpus_limit = soft_vcpus_limit;
26ba25
+#endif
26ba25
+
26ba25
     while (nc->name) {
26ba25
         if (nc->num > soft_vcpus_limit) {
26ba25
             warn_report("Number of %s cpus requested (%d) exceeds "
26ba25
diff --git a/vl.c b/vl.c
26ba25
index 8c89bee..ce7d04d 100644
26ba25
--- a/vl.c
26ba25
+++ b/vl.c
26ba25
@@ -135,6 +135,8 @@ int main(int argc, char **argv)
26ba25
 #define MAX_VIRTIO_CONSOLES 1
26ba25
 #define MAX_SCLP_CONSOLES 1
26ba25
 
26ba25
+#define RHEL_MAX_CPUS 384
26ba25
+
26ba25
 static const char *data_dir[16];
26ba25
 static int data_dir_idx;
26ba25
 const char *bios_name = NULL;
26ba25
@@ -1520,6 +1522,20 @@ MachineClass *find_default_machine(void)
26ba25
     return mc;
26ba25
 }
26ba25
 
26ba25
+/* Maximum number of CPUs limited for Red Hat Enterprise Linux */
26ba25
+static void limit_max_cpus_in_machines(void)
26ba25
+{
26ba25
+    GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
26ba25
+
26ba25
+    for (el = machines; el; el = el->next) {
26ba25
+        MachineClass *mc = el->data;
26ba25
+
26ba25
+        if (mc->max_cpus > RHEL_MAX_CPUS) {
26ba25
+            mc->max_cpus = RHEL_MAX_CPUS;
26ba25
+        }
26ba25
+    }
26ba25
+}
26ba25
+
26ba25
 MachineInfoList *qmp_query_machines(Error **errp)
26ba25
 {
26ba25
     GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
26ba25
@@ -4082,6 +4098,9 @@ int main(int argc, char **argv, char **envp)
26ba25
 
26ba25
     replay_configure(icount_opts);
26ba25
 
26ba25
+    /* Maximum number of CPUs limited for Red Hat Enterprise Linux */
26ba25
+    limit_max_cpus_in_machines();
26ba25
+
26ba25
     machine_class = select_machine();
26ba25
 
26ba25
     set_memory_options(&ram_slots, &maxram_size, machine_class);
26ba25
-- 
26ba25
1.8.3.1
26ba25