From nobody Mon Apr 6 17:06:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01062ECAAD3 for ; Mon, 5 Sep 2022 12:35:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238408AbiIEMfW (ORCPT ); Mon, 5 Sep 2022 08:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238363AbiIEMew (ORCPT ); Mon, 5 Sep 2022 08:34:52 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61CF363F28 for ; Mon, 5 Sep 2022 05:28:36 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MLnkY5L3xzZcNK; Mon, 5 Sep 2022 20:24:05 +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.24; Mon, 5 Sep 2022 20:28:33 +0800 From: Yicong Yang To: , , , , CC: , <21cnbao@gmail.com>, , , , Subject: [PATCH v3] arch_topology: Make cluster topology span at least SMT CPUs Date: Mon, 5 Sep 2022 20:26:15 +0800 Message-ID: <20220905122615.12946-1-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.164.66] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yicong Yang Currently cpu_clustergroup_mask() will return CPU mask if cluster span more or the same CPUs as cpu_coregroup_mask(). This will result topology borken on non-Cluster SMT machines when building with CONFIG_SCHED_CLUSTER=3Dy. Test with: qemu-system-aarch64 -enable-kvm -machine virt \ -net none \ -cpu host \ -bios ./QEMU_EFI.fd \ -m 2G \ -smp 48,sockets=3D2,cores=3D12,threads=3D2 \ -kernel $Image \ -initrd $Rootfs \ -nographic -append "rdinit=3Dinit console=3DttyAMA0 sched_verbose loglevel=3D8" We'll get below error: [ 3.084568] BUG: arch topology borken [ 3.084570] the SMT domain not a subset of the CLS domain Since cluster is a level higher than SMT, fix this by making cluster spans at least SMT CPUs. Cc: Sudeep Holla Cc: Vincent Guittot Cc: Ionela Voinescu Cc: Greg KH Fixes: bfcc4397435d ("arch_topology: Limit span of cpu_clustergroup_mask()") Signed-off-by: Yicong Yang Reviewed-by: Sudeep Holla --- Change since v2: - Use topology_sibling_cpumask() instead of cpu_smt_mask(), which is unavai= lable when CONFIG_SCHED_SMT=3Dn. Sorry for the build regression. - Drop RB from Ionela and Sudeep since code changed. Expect a regain. Thank= s! Link: https://lore.kernel.org/lkml/20220825092007.8129-1-yangyicong@huawei.= com/ Change since v1: - mention the kernel config CONFIG_SCHED_CLUSTER=3Dy, per Ionela Link:https://lore.kernel.org/lkml/20220823073044.58697-1-yangyicong@huawei.= com/ drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 0424b59b695e..7e7e373ffab2 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -724,7 +724,7 @@ const struct cpumask *cpu_clustergroup_mask(int cpu) */ if (cpumask_subset(cpu_coregroup_mask(cpu), &cpu_topology[cpu].cluster_sibling)) - return get_cpu_mask(cpu); + return topology_sibling_cpumask(cpu); =20 return &cpu_topology[cpu].cluster_sibling; } --=20 2.24.0