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