Blame SOURCES/0022-RHEL-Set-vcpus-hard-limit-to-240-for-Power.patch

9bac43
From fdeef3c1c7926a5c8a5b732135ea0a80b177c103 Mon Sep 17 00:00:00 2001
9bac43
From: David Gibson <dgibson@redhat.com>
9bac43
Date: Thu, 3 Sep 2015 04:09:04 +0200
9bac43
Subject: RHEL: Set vcpus hard limit to 240 for Power
9bac43
9bac43
Patchwork-id: 67655
9bac43
O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH] RHEL: Set vcpus hard limit to 240 for Power
9bac43
Bugzilla: 1257781
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9bac43
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9bac43
9bac43
On POWER, the kernel advertises a soft limit based on the number of CPU
9bac43
threads on the host.  We want to allow exceeding this for testing purposes,
9bac43
so we don't want to set hard limit to soft limit as on x86.
9bac43
9bac43
However the POWER hard limit advertised by the kernel is 2048 (== NR_CPUS)
9bac43
but we only want to allow up to the number of vCPUs we actually test, so
9bac43
we force the hard limit to 240.
9bac43
9bac43
Signed-off-by: David Gibson <dgibson@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
(cherry picked from commit 815a8be86930089767730c30cfb6b5373c138cf7)
9bac43
---
9bac43
 accel/kvm/kvm-all.c | 19 +++++++++++++++++++
9bac43
 1 file changed, 19 insertions(+)
9bac43
9bac43
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
9bac43
index b42c56a..80ab1c7 100644
9bac43
--- a/accel/kvm/kvm-all.c
9bac43
+++ b/accel/kvm/kvm-all.c
9bac43
@@ -1627,8 +1627,27 @@ static int kvm_init(MachineState *ms)
9bac43
     soft_vcpus_limit = kvm_recommended_vcpus(s);
9bac43
     hard_vcpus_limit = kvm_max_vcpus(s);
9bac43
 
9bac43
+#ifdef HOST_PPC64
9bac43
+    /*
9bac43
+     * RHEL hack:
9bac43
+     *
9bac43
+     * On POWER, the kernel advertises a soft limit based on the
9bac43
+     * number of CPU threads on the host.  We want to allow exceeding
9bac43
+     * this for testing purposes, so we don't want to set hard limit
9bac43
+     * to soft limit as on x86.
9bac43
+     *
9bac43
+     * However the POWER hard limit advertised by the kernel is 2048
9bac43
+     * (== NR_CPUS) but we only want to allow up to the number of
9bac43
+     * vCPUs we actually test, so we force the hard limit to 240
9bac43
+     */
9bac43
+    hard_vcpus_limit = 240;
9bac43
+    if (soft_vcpus_limit > hard_vcpus_limit) {
9bac43
+        soft_vcpus_limit = hard_vcpus_limit;
9bac43
+    }
9bac43
+#else
9bac43
     /* RHEL doesn't support nr_vcpus > soft_vcpus_limit */
9bac43
     hard_vcpus_limit = soft_vcpus_limit;
9bac43
+#endif
9bac43
 
9bac43
     while (nc->name) {
9bac43
         if (nc->num > soft_vcpus_limit) {
9bac43
-- 
9bac43
1.8.3.1
9bac43