Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4178233ioo; Wed, 25 May 2022 17:29:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaTTTtJ8SBvNOdFT24i08vsyPGHi214hZvPIUC887YRlP7HLD2CLqQg+6XJA6SXZXoqz4l X-Received: by 2002:a17:90a:5c84:b0:1dc:9b42:f2cf with SMTP id r4-20020a17090a5c8400b001dc9b42f2cfmr13305146pji.123.1653524964408; Wed, 25 May 2022 17:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653524964; cv=none; d=google.com; s=arc-20160816; b=W6EUt9kWug4XYQ3BFvCzsEx8Gizb1ZFV5uEurrgtBzY84obj3eL66miCDPeHMqUs9b vzRsSSyCm2cvKqyJL73I7RpNYBQRQ2ekb+yaY6s+c5+ZQ7KXGuuII7ONkc11O8uReEHf iwuMlOxW7zdAT7iluStmqpTVn7XTI7zcDvBdj9Q0aKDJvuRDMob9JnGlqgfVOHUeD1oN HaoBiPNTq3UeubzFIy4+Ses0HNSciKrdUsRpEWCi3VYtdIzC83bGxC+wXl9a9Knv6hCd mkMV9C2wmqZV8kkHVyn6aRoXhvUbvQbfvPazdEXBQu30ELMICtfedfbIZcB/bEtViQkP PYxw== 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=RYJidpW/UZXyiftQV29lSMX/9VEcX8DgW3+JMltOZxg=; b=GebduN+T+f7MmHRmLK35Z9TF7KQg2eddn8SmqcS5Tr5r0xgYgBB+w29HWsWF+GY39E y8EeahmL4g2rQMVVOTV77r6T8N5RE/ZJ66EKuA/cbLRmQ+YoPv+6TuHqqkx4nHPwna6z Hxmh92l3f0nUfV/SPbUtgi1tXgXCyAgTLpntTYT6LO4lHcKYmtdK7+pTxoCam/v6G6vO lSJSPjSoqRLUxh+6EZRiFyhBhIkX6A016wt0ButmvRMkvZB0NB8oLuD/KQSch4UuXp+U lINxo1weQKAcaBQjJuPMn2q2A3W76uppl6ErC1MeiK5OpKch6rcEYyduC59PrhJaboSr AsoA== 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 l8-20020a170903120800b0015ceea6bd9esi21534020plh.550.2022.05.25.17.29.13; Wed, 25 May 2022 17:29:24 -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 S241122AbiEYIQh (ORCPT + 99 others); Wed, 25 May 2022 04:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239867AbiEYIOz (ORCPT ); Wed, 25 May 2022 04:14:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 278398217F for ; Wed, 25 May 2022 01:14:54 -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 A5DAC23A; Wed, 25 May 2022 01:14:53 -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 E3BEE3F73D; Wed, 25 May 2022 01:14:51 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring Subject: [PATCH v3 10/16] arch_topology: Set thread sibling cpumask only within the cluster Date: Wed, 25 May 2022 09:14:10 +0100 Message-Id: <20220525081416.3306043-11-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525081416.3306043-10-sudeep.holla@arm.com> References: <20220525081416.3306043-1-sudeep.holla@arm.com> <20220525081416.3306043-2-sudeep.holla@arm.com> <20220525081416.3306043-3-sudeep.holla@arm.com> <20220525081416.3306043-4-sudeep.holla@arm.com> <20220525081416.3306043-5-sudeep.holla@arm.com> <20220525081416.3306043-6-sudeep.holla@arm.com> <20220525081416.3306043-7-sudeep.holla@arm.com> <20220525081416.3306043-8-sudeep.holla@arm.com> <20220525081416.3306043-9-sudeep.holla@arm.com> <20220525081416.3306043-10-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_PASS,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. 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 76c702c217c5..59dc2c80c439 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -703,15 +703,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