From nobody Fri May 3 14:20:23 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 1491115150741909.8428134062717; Sat, 1 Apr 2017 23:39:10 -0700 (PDT) Received: from localhost ([::1]:53870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuZAJ-0006QO-8r for importer@patchew.org; Sun, 02 Apr 2017 02:39:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuZ9T-00064R-KJ for qemu-devel@nongnu.org; Sun, 02 Apr 2017 02:38:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuZ9P-0005Xw-22 for qemu-devel@nongnu.org; Sun, 02 Apr 2017 02:38:15 -0400 Received: from ozlabs.org ([103.22.144.67]:37259) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cuZ9O-0005XU-My; Sun, 02 Apr 2017 02:38:10 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3vwlt65WD7z9s73; Sun, 2 Apr 2017 16:38:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1491115086; bh=uK1+6pPZpkHDo2ec7/XI+9IYk16UueRtyBnuSP+gs2Y=; h=From:To:Cc:Subject:Date:From; b=MW4F8a7o+9vnymtKyf6c8nhQZ/2cuooMgUHXwpg0ChgCkxBpIgw9GuuPo4zkZpm1j UYHJxX++fuQRmIHdLyBvozpgeuwMnfl1jIDb12tBxlWs7ilz/8M/XZJ25OkKr9lMc8 TBQGbFH1tFhI/r7Lf0tKKZbeJCk37i43Q1OkherM= From: David Gibson To: bharata.rao@gmail.com, imammedo@redhat.com, ehabkost@redhat.com Date: Sun, 2 Apr 2017 16:38:02 +1000 Message-Id: <20170402063802.30997-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 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] [PATCHv2 for-2.9] 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: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, 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" 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