Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4118021iog; Tue, 21 Jun 2022 12:23:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ulXQ7JYuNzbTucxyypaHIhOK4Wca4dnpncKKhICjguuPrsj6KOY1rB8VfrO/x4hVCUv26A X-Received: by 2002:a17:907:1c01:b0:6f4:2692:e23 with SMTP id nc1-20020a1709071c0100b006f426920e23mr26413410ejc.243.1655839423895; Tue, 21 Jun 2022 12:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655839423; cv=none; d=google.com; s=arc-20160816; b=tMWXQPaOSZFrXnHhVlIMoTrwAcGscT02ImtVyttLPqwrGHh/HGkNjI+QiC8zQ7csxZ kNYi0AQ3zvqiuz54VSROyvsIy8eVRGZOa93ODRCAVzDVpUPvC3IqWqT/umR0UGhkpS2y Yc2byFjx7Q6tUTeKwbk37i3nMtHJ4JfCfN4CdafxMt7mWH4j+oej+J7lW05ETRmn5nyh Tb9iNO66RjvbkidRtgXY1JrRRKVVW/3JTJxofus7iFywn6MbIx6FSffg66NyyemmqTrN Rt7r7JrkxYZACAa/5t5Hf0Wm8HRsRZfBkWdhZzCBIn+rJ/0dVguiFZQ/qkBK6jfHl/wS 5C7Q== 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=HngPC78B22rH8p1fjedoadY6fZFJXpjyfNBM1j/DxHA=; b=eWx5OmU6Io0CTIP4XxxEMOwqJK0ieGzCo5mcThryaR1BWhCIKCq7yWgoC/l9zUeASm 12JkIkwrbVElUQakUoBD4QpPD4oruV/Xx/wW9nRUcbF9QMCMDrofJgKh5kUBRCxh8l4C znQEq8VJ8Urim4MPoucw/11dxulqCrkJ3z/tNjMaQDQ2kiU/Lumb3Ru/DyRQw+8LFBVH LfjWz4ebhpq+VvOTjdLTPFJDWSQIdy4ok+1WuKugtGvXBxgGs/p7JMD6fNZAJLb3VtKm FgutBHjWxzV5eECG5cBbluPszfs/mOnvV1WUX2pohoaOPVhRxrwEAr7vSit12yE29OiQ tt2Q== 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 n20-20020a05640206d400b004356442b3a8si2639048edy.177.2022.06.21.12.23.18; Tue, 21 Jun 2022 12:23:43 -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 S1353374AbiFUTVs (ORCPT + 99 others); Tue, 21 Jun 2022 15:21:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353422AbiFUTVM (ORCPT ); Tue, 21 Jun 2022 15:21:12 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7960F1174 for ; Tue, 21 Jun 2022 12:21:11 -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 6FE871688; Tue, 21 Jun 2022 12:21:11 -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 68D063F792; Tue, 21 Jun 2022 12:21:09 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg KH Cc: Sudeep Holla , 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 v4 12/20] arch_topology: Set thread sibling cpumask only within the cluster Date: Tue, 21 Jun 2022 20:20:26 +0100 Message-Id: <20220621192034.3332546-13-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621192034.3332546-1-sudeep.holla@arm.com> References: <20220621192034.3332546-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 imay result in getting the thread siblings wrongs 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. Reviewed-by: Gavin Shan Tested-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