thebeanogamer / rpms / qemu-kvm

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