Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3148235iog; Mon, 27 Jun 2022 10:06:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vlUbYdnkfoofmROM2sMdst5ofwgl3uNRqD/rHrB8Oxe0ebmYSHUm3VBNEozuGtTnBUoVND X-Received: by 2002:a17:90b:1c86:b0:1ee:e795:a6a with SMTP id oo6-20020a17090b1c8600b001eee7950a6amr4374616pjb.205.1656349604463; Mon, 27 Jun 2022 10:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656349604; cv=none; d=google.com; s=arc-20160816; b=q9nrnyUSYW3VchGpJRxZ2dOS3jOXMFSXMxYp25KFpoyb9ujSqlFmysGHKd3v4f137y 3nAFWyqcNn4tFn5HCEld6fwqcXtz2Y0KfOqzHbnpsE6ykUD3e5IDmEZO3Ecx4tSvxwLf G1yPdmFw5a/YrdFGwgatthelhxlHDsiYLYtw6wwzdBm3n8bneeKLJakwHkV8W6pOGge+ QVjSHn49yoegeootyUXBCuN94WRWl2n7sL9RUQ1c1o6C79DGob6KOIzFsm8ggvOc7mYs V75iXpxOZI/jBLwtczp+tX1MF4bMpk/Gl1ZoH/r2DaWz7jue98EGIEmB70pB50fRW65/ xmvg== 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=QhjPq++aOmmKuKxlNB/dJTlr7iuAVGaCCcoYkq5D5c8=; b=fxugGwIjBVR3OYDXLYwTmMJF55np/UK8FauM9x6dZOTHSwIX2MmIfa7ZNwu/uQkg4+ aCkT847uUitt3EQUrj5hvIVSi1AAZUpwAxV7DPJf/HDHVFE/XPFzAITQPF1PF54+btwJ L8oI9A/I1Jnbyh96hv5DzirluXHy85Ue+FDEVYVCSPRHY2eqwiodvd9sw6pKT/vc7hCg hDIn9J0u9Yo4knotTjqD6pr8cuV69TvCg0woTG3exXJqGwA9FkXoQR8a+VKTXiNxxP3m W1V4W2XEuJeHDkVcoUnerQ4gAAjXq68AdfYWzB8MfZL4tIwFP4d6uBDOSyMRrPTF5mcm p6aQ== 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 b14-20020a17090ae38e00b001eccb086c83si13929501pjz.99.2022.06.27.10.06.31; Mon, 27 Jun 2022 10:06:44 -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 S239677AbiF0QwJ (ORCPT + 99 others); Mon, 27 Jun 2022 12:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239555AbiF0Qva (ORCPT ); Mon, 27 Jun 2022 12:51:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D5E61114F for ; Mon, 27 Jun 2022 09:51:29 -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 A1434175A; Mon, 27 Jun 2022 09:51:29 -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 A50543F792; Mon, 27 Jun 2022 09:51:27 -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, Darren Hart Subject: [PATCH v5 16/19] arch_topology: Limit span of cpu_clustergroup_mask() Date: Mon, 27 Jun 2022 17:50:44 +0100 Message-Id: <20220627165047.336669-17-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 From: Ionela Voinescu Currently the cluster identifier is not set on DT based platforms. The reset or default value is -1 for all the CPUs. Once we assign the cluster identifier values correctly, the cluster_sibling mask will be populated and returned by cpu_clustergroup_mask() to contribute in the creation of the CLS scheduling domain level, if SCHED_CLUSTER is enabled. To avoid topologies that will result in questionable or incorrect scheduling domains, impose restrictions regarding the span of clusters, as presented to scheduling domains building code: cluster_sibling should not span more or the same CPUs as cpu_coregroup_mask(). This is needed in order to obtain a strict separation between the MC and CLS levels, and maintain the same domains for existing platforms in the presence of CONFIG_SCHED_CLUSTER, where the new cluster information is redundant and irrelevant for the scheduler. While previously the scheduling domain builder code would have removed MC as redundant and kept CLS if SCHED_CLUSTER was enabled and the cpu_coregroup_mask() and cpu_clustergroup_mask() spanned the same CPUs, now CLS will be removed and MC kept. Link: https://lore.kernel.org/r/20220621192034.3332546-18-sudeep.holla@arm.com Cc: Darren Hart Tested-by: Ionela Voinescu Signed-off-by: Ionela Voinescu Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 46fa1b70b02b..277b65cf3306 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -686,6 +686,14 @@ const struct cpumask *cpu_coregroup_mask(int cpu) const struct cpumask *cpu_clustergroup_mask(int cpu) { + /* + * Forbid cpu_clustergroup_mask() to span more or the same CPUs as + * cpu_coregroup_mask(). + */ + if (cpumask_subset(cpu_coregroup_mask(cpu), + &cpu_topology[cpu].cluster_sibling)) + return get_cpu_mask(cpu); + return &cpu_topology[cpu].cluster_sibling; } -- 2.36.1