From 815a8be86930089767730c30cfb6b5373c138cf7 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 8329392ab135fcaaa7fed94a6e8068dbed0ca473) (cherry picked from commit 598c434cf95391ca5a3ddc0e955221e227bf3344) --- kvm-all.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index a545d53..cc86415 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1633,8 +1633,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