From nobody Tue Feb 10 11:32:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1667286788; cv=none; d=zohomail.com; s=zohoarc; b=IMUTOyecIxL7AOk7rpJfBd7bQXpGxiPyalvqdJRNqRs1CMHf+CEYJN7zdoi7y2tacBsbTSXYInkWTgY1+XJ9Deei0Pn6bFJtgXIfBH+jTGr2esIkFP0Vq1s2JowIy7W8x/LcJx5Q+l5nidUmccMz3hEgfzlM6/MNGwt9/xoC5Yg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667286788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ynMX5AyUC7IKgOOxrfAa0VpKtpY69DGa1Q/eCjdXUME=; b=jae/YUZk3Ear7MxQ0xdg2WL0OHnZrloH/dVF/Pu+24N2nU+Bk/RxXNJCN+ntyAK2zvFcohMZcpwzLX9LTreTs1XUBlngfp5s8nXwmzTj5tXH9HzCCSAFiWfLf/2lKphg+EJaJ0R5JcoFk5m8xUprPNJhwThJ9f2kHALvgp1lJis= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1667286788728939.7964639325534; Tue, 1 Nov 2022 00:13:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oplQy-00055w-Rz; Tue, 01 Nov 2022 03:11:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oplQu-00053h-Np for qemu-devel@nongnu.org; Tue, 01 Nov 2022 03:11:36 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oplQs-0001sL-5N for qemu-devel@nongnu.org; Tue, 01 Nov 2022 03:11:36 -0400 Received: from canpemm500009.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4N1h5W4r7Fz15MF1; Tue, 1 Nov 2022 15:11:27 +0800 (CST) Received: from localhost.localdomain (10.67.164.66) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 1 Nov 2022 15:11:29 +0800 To: , , , , , , , , CC: , , , , , , Subject: [PATCH v4 2/6] hw/acpi/aml-build: Only generate cluster node in PPTT when specified Date: Tue, 1 Nov 2022 15:10:44 +0800 Message-ID: <20221101071048.29553-3-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20221101071048.29553-1-yangyicong@huawei.com> References: <20221101071048.29553-1-yangyicong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.164.66] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.255; envelope-from=yangyicong@huawei.com; helo=szxga08-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Reply-to: Yicong Yang From: Yicong Yang via Errors-To: qemu-devel-bounces+importer=patchew.org+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1667286789927100003 Content-Type: text/plain; charset="utf-8" From: Yicong Yang Currently we'll always generate a cluster node no matter user has specified '-smp clusters=3DX' or not. Cluster is an optional level and will participant the building of Linux scheduling domains and only appears on a few platforms. It's unnecessary to always build it when it cannot reflect the real topology on platforms having no cluster implementation. So only generate the cluster topology in ACPI PPTT when the user has specified it explicitly in -smp. Tested qemu-system-aarch64 with `-smp 8` and linux 6.1-rc1, without this patch: estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_* ff # cluster_cpus 0-7 # cluster_cpus_list 56 # cluster_id with this patch: estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_* ff # cluster_cpus 0-7 # cluster_cpus_list 36 # cluster_id, with no cluster node kernel will make it to physical package id Acked-by: Michael S. Tsirkin Signed-off-by: Yicong Yang Reviewed-by: Yanan Wang Tested-by: Yanan Wang --- hw/acpi/aml-build.c | 2 +- hw/core/machine-smp.c | 2 ++ include/hw/boards.h | 3 +++ qemu-options.hx | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index e6bfac95c7..60c1acf3da 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linke= r, MachineState *ms, 0, socket_id, NULL, 0); } =20 - if (mc->smp_props.clusters_supported) { + if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters= ) { if (cpus->cpus[n].props.cluster_id !=3D cluster_id) { assert(cpus->cpus[n].props.cluster_id > cluster_id); cluster_id =3D cpus->cpus[n].props.cluster_id; diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index b39ed21e65..c3dab007da 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -158,6 +158,8 @@ void machine_parse_smp_config(MachineState *ms, ms->smp.threads =3D threads; ms->smp.max_cpus =3D maxcpus; =20 + mc->smp_props.has_clusters =3D config->has_clusters; + /* sanity-check of the computed topology */ if (sockets * dies * clusters * cores * threads !=3D maxcpus) { g_autofree char *topo_msg =3D cpu_hierarchy_to_string(ms); diff --git a/include/hw/boards.h b/include/hw/boards.h index 311ed17e18..06ed66453f 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -130,11 +130,14 @@ typedef struct { * @prefer_sockets - whether sockets are preferred over cores in smp parsi= ng * @dies_supported - whether dies are supported by the machine * @clusters_supported - whether clusters are supported by the machine + * @has_clusters - whether clusters are explicitly specified in the user + * provided SMP configuration */ typedef struct { bool prefer_sockets; bool dies_supported; bool clusters_supported; + bool has_clusters; } SMPCompatProps; =20 /** diff --git a/qemu-options.hx b/qemu-options.hx index eb38e5dc40..bbdbdef0af 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -349,6 +349,9 @@ SRST :: =20 -smp 2 + + Note: The cluster topology will only be generated in ACPI and exposed + to guest if it's explicitly specified in -smp. ERST =20 DEF("numa", HAS_ARG, QEMU_OPTION_numa, --=20 2.24.0