yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/0015-globally-limit-the-maximum-number-of-CPUs.patch

b697b4
From 354c9ce982e566ddb3c724a57252986dcb7c36db 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
b697b4
index eecd8031cf..8f2a53438f 100644
a83cc2
--- a/accel/kvm/kvm-all.c
a83cc2
+++ b/accel/kvm/kvm-all.c
b697b4
@@ -2423,6 +2423,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
-- 
a83cc2
2.27.0
a83cc2