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

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