Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3166168iog; Mon, 27 Jun 2022 10:29:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLjOG41NSxDutbVnDYOil6W4JdZyGog2RkiPUejJdPVH6A0dD0qT9y4neAz4NsClkDKG84 X-Received: by 2002:a05:6402:2396:b0:435:775b:b136 with SMTP id j22-20020a056402239600b00435775bb136mr18470606eda.299.1656350966969; Mon, 27 Jun 2022 10:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656350966; cv=none; d=google.com; s=arc-20160816; b=Nqe8aX/RJyOFPR7D9f5TTbdySwnfgN42KGah9MzXzPlMlNnmwwhpVyJM0aIBTqm5Re X/fiPFjSHIdMZrAERjj5liaxJSCSMtNOWGpVyltRosLfcimTYLWt+lF2vwrkn64soGBu Z3CAFD/9VRlDrZUdl4wLElYDH52aoFqUVL4pPVm92IMCh1JjexUU1d2A2QTSCiic6gwa 6qoNz61yh+yric8cIhzug428niwG95n4NRtUc18X6m1xTdr52DGlNnRyE30CrRDFCHkU F/v+rbfmIXsgDEyfdXpAoQye+6zrp5KCeW109+l/WOhIjwif7Z+vAo8cQn6iQqy4vqS+ lNfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ys5hsXQDa8Kf11lRFCs9/C6+B2MtaZHEH9as1OXLqjU=; b=al2EN1iPx9bBow1I9XG/rvm7TwmZChAuAnWq9/eibMJJjYAqe+g+9QsUixa4W7aEz0 ZwmeoqdtijoVNsC+WG4MAhTwekdbM/hzAEekZiSEjkU3OoTYOPvWyFqllGYfIfYKjdrO 3zEbEduBaD+nBLJVSPelSMNwUciMRdocq+gMxHWgssN/nLak+VU1h4nlPcLWrGtwrs0y t3gBtPxd3wEpwtEyxo5CsPf6lfRNT+ulCYvPMMF/T0P+j2E1zZwzy7cIkIbcKYwbIFws KYTbUmJpOW5j6Vk7fJVW7o/mJTmqU+/1NcXr8h4qTVrOev4iR1OE03CKKCDriRxsK7aR DJbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a056402354b00b0043566d6b6d7si11991181edd.451.2022.06.27.10.29.02; Mon, 27 Jun 2022 10:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239636AbiF0Qvr (ORCPT + 99 others); Mon, 27 Jun 2022 12:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239451AbiF0QvX (ORCPT ); Mon, 27 Jun 2022 12:51:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C7CBC1180D for ; Mon, 27 Jun 2022 09:51:21 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBF55175A; Mon, 27 Jun 2022 09:51:21 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CFDD63F792; Mon, 27 Jun 2022 09:51:19 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Atish Patra , Atish Patra , Vincent Guittot , Dietmar Eggemann , Qing Wang , Rob Herring , "Rafael J . Wysocki" , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Gavin Shan Subject: [PATCH v5 12/19] arch_topology: Set thread sibling cpumask only within the cluster Date: Mon, 27 Jun 2022 17:50:40 +0100 Message-Id: <20220627165047.336669-13-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627165047.336669-1-sudeep.holla@arm.com> References: <20220627165047.336669-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the cluster identifier is not set on the DT based platforms. The reset or default value is -1 for all the CPUs. Once we assign the cluster identifier values correctly that may result in getting the thread siblings wrong as the core identifiers can be same for 2 different CPUs belonging to 2 different cluster. So, in order to get the thread sibling cpumasks correct, we need to update them only if the cores they belong are in the same cluster within the socket. Let us skip updation of the thread sibling cpumaks if the cluster identifier doesn't match. This change won't affect even if the cluster identifiers are not set currently but will avoid any breakage once we set the same correctly. Link: https://lore.kernel.org/r/20220621192034.3332546-13-sudeep.holla@arm.com Tested-by: Gavin Shan Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index b63cc52e12ce..7a5ff1ea5f00 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -708,15 +708,17 @@ void update_siblings_masks(unsigned int cpuid) if (cpuid_topo->package_id != cpu_topo->package_id) continue; - if (cpuid_topo->cluster_id == cpu_topo->cluster_id && - cpuid_topo->cluster_id != -1) { + cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); + cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); + + if (cpuid_topo->cluster_id != cpu_topo->cluster_id) + continue; + + if (cpuid_topo->cluster_id != -1) { cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); } - cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); - cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); - if (cpuid_topo->core_id != cpu_topo->core_id) continue; -- 2.36.1