From nobody Fri May 3 17:20:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495521494236766.601560038525; Mon, 22 May 2017 23:38:14 -0700 (PDT) Received: from localhost ([::1]:46375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dD3SO-0004re-1O for importer@patchew.org; Tue, 23 May 2017 02:38:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dD3RI-0004CO-Qk for qemu-devel@nongnu.org; Tue, 23 May 2017 02:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dD3RH-0003fk-1e for qemu-devel@nongnu.org; Tue, 23 May 2017 02:37:04 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:59007) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dD3RG-0003e1-4c; Tue, 23 May 2017 02:37:02 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wX5RG1wq2z9sNv; Tue, 23 May 2017 16:36:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1495521418; bh=Np0oS1SEenmrRhv/Nyt6B13LikNkkbTiIRJe1FlUBuA=; h=From:To:Cc:Subject:Date:From; b=AnE/KTsHjKhhQ5cBlzzcBzwLKj+pjqXUu7Q156IsRmeTcLLmAiw+MxJbwKnnni5mZ eH70YhNB7lfGij691YKd14nnov0B4lq7yoxsWsmzkq+hVas5vHZI9P8vR8YFMZXVDI h4F7Obfd3FL8Df82I/BlAIjSunTTGEkddae/20aw= From: David Gibson To: groug@kaod.org, bharata@linux.vnet.ibm.com Date: Tue, 23 May 2017 16:36:45 +1000 Message-Id: <20170523063645.1247-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PATCH] pseries: Restore support for total vcpus not a multiple of threads-per-core for old machine types X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As of pseries-2.7 and later, we require the total number of guest vcpus to be a multiple of the threads-per-core. pseries-2.6 and earlier machine types, however, are supposed to allow this for the sake of migration from old qemu versions which allowed this. Unfortunately, 8149e29 "pseries: Enforce homogeneous threads-per-core" broke this by not considering the old machine type case. This fixes it by only applying the check when the machine type supports hotpluggable cpus. By not-entirely-coincidence, that corresponds to the same time when we started enforcing total threads being a multiple of threads-per-core. Fixes: 8149e2992f7811355cc34721b79d69d1a3a667dd Signed-off-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Laurent Vivier Tested-by: Greg Kurz --- hw/ppc/spapr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c92d269..bcb0e18 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2863,7 +2863,13 @@ static void spapr_core_pre_plug(HotplugHandler *hotp= lug_dev, DeviceState *dev, goto out; } =20 - if (cc->nr_threads !=3D smp_threads) { + /* + * In general we should have homogeneous threads-per-core, but old + * (pre hotplug support) machine types allow the last core to have + * reduced threads as a compatibility hack for when we allowed + * total vcpus not a multiple of threads-per-core. + */ + if (mc->has_hotpluggable_cpus && (cc->nr_threads !=3D smp_threads)) { error_setg(errp, "invalid nr-threads %d, must be %d", cc->nr_threads, smp_threads); return; --=20 2.9.4