thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
586cba
From 9ebfd2f6cfa8e79c92e58fd169f90cc768fb865a Mon Sep 17 00:00:00 2001
495e37
From: Andrew Jones <drjones@redhat.com>
495e37
Date: Tue, 21 Jan 2014 10:46:52 +0100
495e37
Subject: globally limit the maximum number of CPUs
495e37
495e37
We now globally limit the number of VCPUs.
495e37
Especially, there is no way one can specify more than
495e37
max_cpus VCPUs for a VM.
495e37
495e37
This allows us the restore the ppc max_cpus limitation to the upstream
495e37
default and minimize the ppc hack in kvm-all.c.
495e37
495e37
Signed-off-by: David Hildenbrand <david@redhat.com>
495e37
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
Signed-off-by: Danilo Cesar Lemes de Paula <ddepaula@redhat.com>
495e37
---
495e37
 accel/kvm/kvm-all.c | 12 ++++++++++++
495e37
 1 file changed, 12 insertions(+)
495e37
495e37
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
586cba
index 5f1377ca04..fdf0e4d429 100644
495e37
--- a/accel/kvm/kvm-all.c
495e37
+++ b/accel/kvm/kvm-all.c
586cba
@@ -2430,6 +2430,18 @@ static int kvm_init(MachineState *ms)
495e37
     soft_vcpus_limit = kvm_recommended_vcpus(s);
495e37
     hard_vcpus_limit = kvm_max_vcpus(s);
495e37
 
495e37
+#ifdef HOST_PPC64
495e37
+    /*
495e37
+     * On POWER, the kernel advertises a soft limit based on the
495e37
+     * number of CPU threads on the host.  We want to allow exceeding
495e37
+     * this for testing purposes, so we don't want to set hard limit
495e37
+     * to soft limit as on x86.
495e37
+     */
495e37
+#else
495e37
+    /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */
495e37
+    hard_vcpus_limit = soft_vcpus_limit;
495e37
+#endif
495e37
+
495e37
     while (nc->name) {
495e37
         if (nc->num > soft_vcpus_limit) {
495e37
             warn_report("Number of %s cpus requested (%d) exceeds "
495e37
-- 
586cba
2.31.1
495e37