|
|
357786 |
From 0abcd4ae8344b523f2b462a182fddf181d2b2fa5 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Andrew Jones <drjones@redhat.com>
|
|
|
9bac43 |
Date: Tue, 21 Jan 2014 10:46:52 +0100
|
|
|
9bac43 |
Subject: use recommended max vcpu count
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Andrew Jones <drjones@redhat.com>
|
|
|
9bac43 |
Message-id: <1390301212-15344-1-git-send-email-drjones@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 56862
|
|
|
9bac43 |
O-Subject: [RHEL7.0 qemu-kvm PATCH v6] use recommended max vcpu count
|
|
|
9bac43 |
Bugzilla: 998708
|
|
|
9bac43 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
The recommended vcpu max limit (KVM_CAP_NR_VCPUS) should be used instead
|
|
|
9bac43 |
of the actual max vcpu limit (KVM_CAP_MAX_VCPUS) to give an error.
|
|
|
9bac43 |
|
|
|
357786 |
This commit matches the limit to current KVM_CAP_NR_VCPUS value.
|
|
|
357786 |
|
|
|
357786 |
Rebase notes (2.11.0):
|
|
|
357786 |
- Update commit log
|
|
|
357786 |
|
|
|
357786 |
Merged patches 2.12.0:
|
|
|
357786 |
- 6553300 redhat: globally limit the maximum number of CPUs
|
|
|
357786 |
- 8453db7 redhat: remove manual max_cpus limitations for ppc
|
|
|
357786 |
|
|
|
357786 |
Merged patches (2.11.0):
|
|
|
357786 |
- fdeef3c1c7 RHEL: Set vcpus hard limit to 240 for Power
|
|
|
357786 |
- 0584216921 Match POWER max cpus to x86
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Andrew Jones <drjones@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit a4ceb63bdc5cbac19f5f633ec761b9de0dedb55e)
|
|
|
357786 |
(cherry picked from commit a1f26d85171b4d554225150053700e93ba6eba10)
|
|
|
357786 |
(cherry picked from commit 00b09fb8ae2fa23abfaba4e89f7daa1ba0ef9ec5)
|
|
|
357786 |
(cherry picked from commit bd420a814a24c56d1ff1564d92f36219106ef81b)
|
|
|
357786 |
(cherry picked from commit 79b73eacc15f2c06587734c6259b49d911327369)
|
|
|
9bac43 |
---
|
|
|
357786 |
accel/kvm/kvm-all.c | 12 ++++++++++++
|
|
|
357786 |
vl.c | 23 +++++++++++++++++++++++
|
|
|
357786 |
2 files changed, 35 insertions(+)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
|
|
|
357786 |
index ffee68e..3f1c06e 100644
|
|
|
9bac43 |
--- a/accel/kvm/kvm-all.c
|
|
|
9bac43 |
+++ b/accel/kvm/kvm-all.c
|
|
|
357786 |
@@ -1587,6 +1587,18 @@ static int kvm_init(MachineState *ms)
|
|
|
9bac43 |
soft_vcpus_limit = kvm_recommended_vcpus(s);
|
|
|
9bac43 |
hard_vcpus_limit = kvm_max_vcpus(s);
|
|
|
9bac43 |
|
|
|
357786 |
+#ifdef HOST_PPC64
|
|
|
357786 |
+ /*
|
|
|
357786 |
+ * On POWER, the kernel advertises a soft limit based on the
|
|
|
357786 |
+ * number of CPU threads on the host. We want to allow exceeding
|
|
|
357786 |
+ * this for testing purposes, so we don't want to set hard limit
|
|
|
357786 |
+ * to soft limit as on x86.
|
|
|
357786 |
+ */
|
|
|
357786 |
+#else
|
|
|
9bac43 |
+ /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */
|
|
|
9bac43 |
+ hard_vcpus_limit = soft_vcpus_limit;
|
|
|
357786 |
+#endif
|
|
|
9bac43 |
+
|
|
|
9bac43 |
while (nc->name) {
|
|
|
9bac43 |
if (nc->num > soft_vcpus_limit) {
|
|
|
357786 |
warn_report("Number of %s cpus requested (%d) exceeds "
|
|
|
357786 |
diff --git a/vl.c b/vl.c
|
|
|
357786 |
index cbd6bcc..f3acab3 100644
|
|
|
357786 |
--- a/vl.c
|
|
|
357786 |
+++ b/vl.c
|
|
|
357786 |
@@ -135,6 +135,12 @@ int main(int argc, char **argv)
|
|
|
357786 |
#define MAX_VIRTIO_CONSOLES 1
|
|
|
357786 |
#define MAX_SCLP_CONSOLES 1
|
|
|
357786 |
|
|
|
357786 |
+#if defined(CONFIG_RHV)
|
|
|
357786 |
+#define RHEL_MAX_CPUS 384
|
|
|
357786 |
+#else
|
|
|
357786 |
+#define RHEL_MAX_CPUS 240
|
|
|
357786 |
+#endif
|
|
|
357786 |
+
|
|
|
357786 |
static const char *data_dir[16];
|
|
|
357786 |
static int data_dir_idx;
|
|
|
357786 |
const char *bios_name = NULL;
|
|
|
357786 |
@@ -1520,6 +1526,20 @@ MachineClass *find_default_machine(void)
|
|
|
357786 |
return mc;
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
+/* Maximum number of CPUs limited for Red Hat Enterprise Linux */
|
|
|
357786 |
+static void limit_max_cpus_in_machines(void)
|
|
|
357786 |
+{
|
|
|
357786 |
+ GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
|
|
|
357786 |
+
|
|
|
357786 |
+ for (el = machines; el; el = el->next) {
|
|
|
357786 |
+ MachineClass *mc = el->data;
|
|
|
357786 |
+
|
|
|
357786 |
+ if (mc->max_cpus > RHEL_MAX_CPUS) {
|
|
|
357786 |
+ mc->max_cpus = RHEL_MAX_CPUS;
|
|
|
357786 |
+ }
|
|
|
357786 |
+ }
|
|
|
357786 |
+}
|
|
|
357786 |
+
|
|
|
357786 |
MachineInfoList *qmp_query_machines(Error **errp)
|
|
|
357786 |
{
|
|
|
357786 |
GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
|
|
|
357786 |
@@ -4084,6 +4104,9 @@ int main(int argc, char **argv, char **envp)
|
|
|
357786 |
|
|
|
357786 |
replay_configure(icount_opts);
|
|
|
357786 |
|
|
|
357786 |
+ /* Maximum number of CPUs limited for Red Hat Enterprise Linux */
|
|
|
357786 |
+ limit_max_cpus_in_machines();
|
|
|
357786 |
+
|
|
|
357786 |
machine_class = select_machine();
|
|
|
357786 |
|
|
|
357786 |
set_memory_options(&ram_slots, &maxram_size, machine_class);
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|