yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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