Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3492449pxp; Tue, 8 Mar 2022 15:51:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5xCJl5Pe691FOAj+MPmTDLEZNa1qRtBRCRa9dy19BhEmxAl1UPwqmxsrqZVfFWehsuTuq X-Received: by 2002:a65:4348:0:b0:375:9840:b064 with SMTP id k8-20020a654348000000b003759840b064mr16604541pgq.270.1646783481485; Tue, 08 Mar 2022 15:51:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646783481; cv=none; d=google.com; s=arc-20160816; b=ExTGeAqSk8VgerzOXly4/xZIxrTcUWWoZq769Gcya89YVRa8nKoBTzFRIw063n0An+ fE8Yg2r+2UKCTgc4gxppNSykh5DMMKS/dAGiEmxMNXRvggaP0eksCZq1vzHx3Gy5zWhE uj1S1EjSE1s/Cs0Ed9lHIqTYXBy1DGmHn0m5RuXZe2G6FWuZFB412BzWAPQU94aDwcka 009XpVA6am7Hvxi5YbxS+VF+gXktKfuxnCDaEvansRTw2iYLb/pATV/9a5I74tSrfZnX 3kAJyfa5GDALr4tsAATtC8SwTDkP6iVhGjvga+011T0nVNieLBuQ56XuCeFmTuCjGlxT yd7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DFDPk5qebHxCNykqcMyJ+TNtnybl5Cnbd1j7b5v2pgY=; b=audqowsGGTM16D7tiQpSQkx474UVYmHr4peIIZCMeaWqsVzLnAOQ3KNkmPjmoJ6Edu FhE7MBC9f213A4ENJsrgDcE2u7M+M9expS8Cu+xpo656q6KEHE688ZYkJnPtQt3FRWGX d+cA1ykyiT/3VRnS9A7AeN3+BdiCOaSx7ovyYWXIa/K1dbcuMADmi+ql2vG9Ujc2Peym Y0kl/AjETNGCvebht+F9gPs1DZEir6+PYIsQFR+Km8FidYIQdwnLbeEJOmSgvEn6ALa8 uIsFNv96Bbgq9xBtl3Xp0Lc+YUQBm2gNKRO+o197ZvCRc3QiV9YY6PYM3BOw7MjOgGqU lwwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M1oThiuo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e8-20020a056a001a8800b004e1d864ca0bsi234908pfv.346.2022.03.08.15.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 15:51:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M1oThiuo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C5C82C9A2D; Tue, 8 Mar 2022 15:31:06 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244348AbiCHKbR (ORCPT + 99 others); Tue, 8 Mar 2022 05:31:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243608AbiCHKbQ (ORCPT ); Tue, 8 Mar 2022 05:31:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D553C3C49C; Tue, 8 Mar 2022 02:30:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6CB3C61580; Tue, 8 Mar 2022 10:30:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C1DBC340EF; Tue, 8 Mar 2022 10:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646735418; bh=E6G3HiPLRyrOj03X2ujBXJMTzrUxMjwNhkXg21CG+U8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M1oThiuofqh3xeFKZQaytRfDhYBezMDPsbC39YerDdHh4F5nK9JK8QrEQH8Xxzizj mdWhdifioc/a36RrkAwGUv65W9qE7o1eN1jkLp4RWCDC7Jgl1oxN7iCGMQBhtxphnF fYFXZ+SB2c1J3cTZ+CHANzEIThoY+23DDUbftNvRq9GlTi6F7Kzjw08oaqeJd7FfFK TpsQGsL5y4USLmVhRnavuC4O3JyMGFn5rDAlu9ec98fguQ2Q/S3mQKMf4yN7zdKSYI wRRCQsLdmNRI831GB4+IYcSC9ty4y3TKUD87YJlxwfyY7EKo3+PUg9acrBX54Kmh5Y n5f8EsboETDvw== Date: Tue, 8 Mar 2022 10:30:12 +0000 From: Will Deacon To: Darren Hart Cc: LKML , Linux Arm , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Catalin Marinas , Peter Zijlstra , Vincent Guittot , Barry Song , Valentin Schneider , "D . Scott Phillips" , Ilkka Koskinen , stable@vger.kernel.org Subject: Re: [PATCH v3] topology: make core_mask include at least cluster_siblings Message-ID: <20220308103012.GA31267@willie-the-truck> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Fri, Mar 04, 2022 at 09:01:36AM -0800, Darren Hart wrote: > Ampere Altra defines CPU clusters in the ACPI PPTT. They share a Snoop > Control Unit, but have no shared CPU-side last level cache. > > cpu_coregroup_mask() will return a cpumask with weight 1, while > cpu_clustergroup_mask() will return a cpumask with weight 2. > > As a result, build_sched_domain() will BUG() once per CPU with: > > BUG: arch topology borken > the CLS domain not a subset of the MC domain > > The MC level cpumask is then extended to that of the CLS child, and is > later removed entirely as redundant. This sched domain topology is an > improvement over previous topologies, or those built without > SCHED_CLUSTER, particularly for certain latency sensitive workloads. > With the current scheduler model and heuristics, this is a desirable > default topology for Ampere Altra and Altra Max system. > > Rather than create a custom sched domains topology structure and > introduce new logic in arch/arm64 to detect these systems, update the > core_mask so coregroup is never a subset of clustergroup, extending it > to cluster_siblings if necessary. > > This has the added benefit over a custom topology of working for both > symmetric and asymmetric topologies. It does not address systems where > the cluster topology is above a populated mc topology, but these are not > considered today and can be addressed separately if and when they > appear. > > The final sched domain topology for a 2 socket Ampere Altra system is > unchanged with or without CONFIG_SCHED_CLUSTER, and the BUG is avoided: > > For CPU0: > > CONFIG_SCHED_CLUSTER=y > CLS [0-1] > DIE [0-79] > NUMA [0-159] > > CONFIG_SCHED_CLUSTER is not set > DIE [0-79] > NUMA [0-159] > > Cc: Sudeep Holla > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Peter Zijlstra > Cc: Vincent Guittot > Cc: Barry Song > Cc: Valentin Schneider > Cc: D. Scott Phillips > Cc: Ilkka Koskinen > Cc: # 5.16.x > Suggested-by: Barry Song > Signed-off-by: Darren Hart > --- > v1: Drop MC level if coregroup weight == 1 > v2: New sd topo in arch/arm64/kernel/smp.c > v3: No new topo, extend core_mask to cluster_siblings > > 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 976154140f0b..a96f45db928b 100644 > --- a/drivers/base/arch_topology.c > +++ b/drivers/base/arch_topology.c > @@ -628,6 +628,14 @@ const struct cpumask *cpu_coregroup_mask(int cpu) > core_mask = &cpu_topology[cpu].llc_sibling; > } > > + /* > + * For systems with no shared cpu-side LLC but with clusters defined, > + * extend core_mask to cluster_siblings. The sched domain builder will > + * then remove MC as redundant with CLS if SCHED_CLUSTER is enabled. > + */ > + if (cpumask_subset(core_mask, &cpu_topology[cpu].cluster_sibling)) > + core_mask = &cpu_topology[cpu].cluster_sibling; > + Sudeep, Vincent, are you happy with this now? Will