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