From nobody Sun Apr 28 14:57:16 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 1491214202037663.24768839538; Mon, 3 Apr 2017 03:10:02 -0700 (PDT) Received: from localhost ([::1]:58333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuyvw-0000Q4-2G for importer@patchew.org; Mon, 03 Apr 2017 06:10:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuyum-0008Hg-8c for qemu-devel@nongnu.org; Mon, 03 Apr 2017 06:08:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuyuj-0003vy-0M for qemu-devel@nongnu.org; Mon, 03 Apr 2017 06:08:48 -0400 Received: from ozlabs.org ([103.22.144.67]:55777) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cuyuh-0003se-T9; Mon, 03 Apr 2017 06:08:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3vxSVX6HwBz9s7r; Mon, 3 Apr 2017 20:08:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1491214116; bh=6C6z5zRgkYJonlRnIb1DsA9liDSf7IUr7QJiwxTVfoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/IPoAm9j9Oh5LI+vmO4Pgx8YpTAAlPjJHKDMWKP9k6gw3JcAcgB5guoPUmAkq1mz p+V7va/dkkrifD+Phl/plAvf+mdlpdMtcV1il4xNSC9x8972Wh4fUAc4MIWuL9O4CB EcuCiM8dVIvYWmq1KH5IjW5PMdE7WQvaYbVm7eDo= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 3 Apr 2017 20:08:32 +1000 Message-Id: <20170403100832.24088-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403100832.24088-1-david@gibson.dropbear.id.au> References: <20170403100832.24088-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 1/1] pseries: Enforce homogeneous threads-per-core 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: qemu-devel@nongnu.org, agraf@suse.de, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, imammedo@redhat.com, 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" For reasons that may be useful in future, CPU core objects, as used on the pseries machine type have their own nr-threads property, potentially allowing cores with different numbers of threads in the same system. If the user/management uses the values specified in query-hotpluggable-cpus as they're expected to do, this will never matter in pratice. But that's not actually enforced - it's possible to manually specify a core with a different number of threads from that in -smp. That will confuse the platform - most immediately, this can be used to create a CPU thread with index above max_cpus which leads to an assertion failure in spapr_cpu_core_realize(). For now, enforce that all cores must have the same, standard, number of threads. Signed-off-by: David Gibson Reviewed-by: Bharata B Rao --- hw/ppc/spapr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 44c26e4..35db949 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2790,6 +2790,12 @@ static void spapr_core_pre_plug(HotplugHandler *hotp= lug_dev, DeviceState *dev, goto out; } =20 + if (cc->nr_threads !=3D smp_threads) { + error_setg(errp, "invalid nr-threads %d, must be %d", + cc->nr_threads, smp_threads); + return; + } + core_slot =3D spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &= index); if (!core_slot) { error_setg(&local_err, "core id %d out of range", cc->core_id); --=20 2.9.3