Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4130484iog; Tue, 21 Jun 2022 12:41:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v/JyTUlWnE5/n409voobPzZxbDsG401YKeJef9IKvOYujkhmDrdqbHPCP0F6AVzzRJgwwI X-Received: by 2002:a17:902:7596:b0:16a:3bea:11eb with SMTP id j22-20020a170902759600b0016a3bea11ebmr3583939pll.154.1655840519398; Tue, 21 Jun 2022 12:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655840519; cv=none; d=google.com; s=arc-20160816; b=MUCqF2Eevzw/Zygkz46ACdbdxnNPdABiJmek99z2drSRJrSDQgkBKbP/B3HrjU40sd OGydN1VTSBd9kfXswpQGf11s/LXp8dglrok5sucJ1RGaNdgyqmRNsC6peFyqFVvnW+D+ y50Kkn0Bd8Wjsqxa7Qmj4l/3PAIUAM7uI/4xZUcdZ129jvLMmDryIdch+0okwJ7wABv0 /G0EfjRwLASwsbdMtZA+2+03q4KCj2Lv6wasmPV+F8KGMDi7C/UiwvcUCD2Riv7HFHZ2 7EqeaoIhOKg5kXgg1q1eUGFWUE0Dst6HF3yKHJ1uTk1xErPVO0zFNq1LcQ4cHusKWrga 0B2A== 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=vS54MzMx7ri4xW2RzUVHMd8Mi9f9rDr7oPhSww2Nfss=; b=UX7tJo5UoA+9rfPnghgcsg1y8aWZHBkrG3/tn4a+22IOO3HELbN6d0uFisieidVT1i awEYYmlfKOJCkhTZseIScaQ8zwRSRes3uKPPuNccKruTUX5HLWFV9JNuEcoKGw9eNJm1 CGbaUP/cbCiFOyT8SIUIqp+kxHhU5628oBmacE3JXSfdDr05XBDtooJ+JTLuFLOVl4SS pNKpks+/GC5kqX16+q1/atRYtzM/5peiCJTCZMpG/cxLRhN9V05CoqIaNCJXkZX+ZiUl vSurL9Xi+/8OAHIgKKil/P2C/L9BgqUrVJ1B03MOqvOSzDcFyyZ1Ex2OGQxXNyvQm/g/ 27WA== 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 k14-20020a170902760e00b001677fa2026asi18588671pll.609.2022.06.21.12.41.47; Tue, 21 Jun 2022 12:41:59 -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 S1353874AbiFUTWK (ORCPT + 99 others); Tue, 21 Jun 2022 15:22:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351967AbiFUTVX (ORCPT ); Tue, 21 Jun 2022 15:21:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EC9B512AE0 for ; Tue, 21 Jun 2022 12:21: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 DC6E8165C; Tue, 21 Jun 2022 12:21: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 D18AE3F792; Tue, 21 Jun 2022 12:21:19 -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, Darren Hart Subject: [PATCH v4 17/20] arch_topology: Limit span of cpu_clustergroup_mask() Date: Tue, 21 Jun 2022 20:20:31 +0100 Message-Id: <20220621192034.3332546-18-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 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. Cc: Darren Hart 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 42448a5a9412..39be5dbaf4da 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -675,6 +675,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