Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1457262imk; Mon, 4 Jul 2022 03:32:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t66J1O+A1PNu2Tg695LjrX1R75pL5GjhVvOxsAMBliEzl0GBuYK6REUcL0O5493vwGIhhv X-Received: by 2002:a17:903:1314:b0:16b:e832:7292 with SMTP id iy20-20020a170903131400b0016be8327292mr2137218plb.56.1656930755852; Mon, 04 Jul 2022 03:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656930755; cv=none; d=google.com; s=arc-20160816; b=PN6S1ckIdadYy2246OcbKyg5Q+30CjLWOCql4Dc8CxGQrHBO2CUDxyqgnCjIf5tzjU LHcjF28pqAUu/l7ixgUHMY6eplUxrl8W5fVymn2MQyxvr5HXEX9tg7ZDU54Vi92yTOYe tA8jzErsW19RED3Hur0jZ0DoNQS1plCcjI9vQQvq3d+Fh1acL0OVDGPR+1WZmHEM3hcz VPGYm45qH0hW/2X/F7L88yJO2XlTWXhXuNSLy1ZTrEQW6PenwhO6yvlhxr3CwA5Snc22 KV+HsFdHpy0Lfi2CziKJrSz6Q214j0yxxMDkPOT7Cp5HsMusPz+tQnsxlm+ncn/wXw41 oTSg== 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=tp9jBHm5wG89gPsGaH2QLSw6R2EIasGHIB5/PGe7Qs8=; b=dNowrcP7GBne2ghR2hQkIDHfS15ByjmJzk5JAJABhaF4tiMu0NZKeDu0/1Z1D+LKlh IUQI0PKalOuOUUrkMWOq8LTG2pxXk9ekHluS6dJUpycDuL7pLGnmZ8QLOkIjWo5qRfhl hJcvZuK22N30bu5qroAD5LGGnbfTkIQDW8kdwBgvYJ04OM0B2CGg8M+anCsYfL/IIvSv CJc20h9irvBbD7e6h6ihFTdce60lhyTlEf188/NFyqtdQ2JK2ebQkMZxKiMJ3b+opW6Q /hUjMcSv0JaoF026STVQq5KYxml/WqBU17ttk5EbS8U3icuWSxLkOnhr6czj2OMsph5n t3gA== 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 t131-20020a635f89000000b003c62d1ccb94si41518116pgb.179.2022.07.04.03.32.24; Mon, 04 Jul 2022 03:32:35 -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 S234068AbiGDKSL (ORCPT + 99 others); Mon, 4 Jul 2022 06:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234121AbiGDKQw (ORCPT ); Mon, 4 Jul 2022 06:16:52 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0482ADFCC for ; Mon, 4 Jul 2022 03:16:51 -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 1EF1C23A; Mon, 4 Jul 2022 03:16:51 -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 E61003F792; Mon, 4 Jul 2022 03:16:48 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Sudeep Holla , conor.dooley@microchip.com, valentina.fernandezalanis@microchip.com, 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 v6 17/21] arch_topology: Limit span of cpu_clustergroup_mask() Date: Mon, 4 Jul 2022 11:16:01 +0100 Message-Id: <20220704101605.1318280-18-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704101605.1318280-1-sudeep.holla@arm.com> References: <20220704101605.1318280-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 Acked-by: Vincent Guittot 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 e384afb6cac7..591c1f8e15e2 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.37.0