Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3567981pxp; Tue, 8 Mar 2022 17:40:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5di3t5J356x1hZ4rB+gy4t/4i0s0B+PovjW4mGHM1riHX6XnRZAR3p3nRdd+tCT09ZT+u X-Received: by 2002:a17:903:40c2:b0:153:425:3f7b with SMTP id t2-20020a17090340c200b0015304253f7bmr301622pld.16.1646790016579; Tue, 08 Mar 2022 17:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646790016; cv=none; d=google.com; s=arc-20160816; b=rrdtNaL00Vx8jugh4BsI4dur+g8AHwC6d36isA1eXLeS9sbPbgiqfmJsGhSPPFdHrH Zr9ZQJqw36fFHVpTO6Gi5LexnaxXbsssP7uy1OM2iXUDmN/0oooOLvrmiXzQQzPNev6q RTN8yqOklZFkqTFTw7vzO7wpUyjUrJlhwJV+Df+TrKAOK4U1wQpkWCHIBfpy6PLmzlP6 4HuWv2Y69kW1MnjtkWR4TS9+eyaI4kUaRVeoP+JNnjYxTTWT7mZY89Q16ZfovtVuTjWe d08nUmRjhOcWkSCiWbVgJ/xmiYJlEqkoV3bp8o7rTG1SnF6L6CU20q4L4WtKdQKPFbZm hsVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=AbMjXFTZqRPHOHj1ESQJkowE9CU+bRJpxVipSqG4OjA=; b=uAvVGPK3F+t0kdimIZiMkeu83CFjyooum9AMZ0jxBohUxI9kp3bkuVgjsS8ggdjlhp 7XicP2ZtSjMyV+hqS5YVEUn/PSfyFse8/NIrbzUuXKlfEIexcrrJ9NQ0jOxAPFeZ7uPj jE+124D2yC11XlTSoGWsKlieXFQCRtdx+96x2/xGCb8qhtGceR9i9BGIsJqPqXohUUF6 LdAp4NXzteRZpPWHL2NYXzs+pudkvDNFTl27KtSdfM+oSxOHdDQBUquq46AFeifb9ENK LgYrjVh0jSWfsLENzECTu4QdWLyIrJEIjaLxKetjnQ5M3670Bnn2yJKaTT+8kWrc5pdf DyIg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k11-20020a17090a658b00b001bd14e0307fsi3837510pjj.87.2022.03.08.17.40.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 17:40:16 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 966B521EBAA; Tue, 8 Mar 2022 16:33:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243704AbiCHQEF (ORCPT + 99 others); Tue, 8 Mar 2022 11:04:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbiCHQEC (ORCPT ); Tue, 8 Mar 2022 11:04:02 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50925496A2; Tue, 8 Mar 2022 08:03:06 -0800 (PST) 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 C0CAC139F; Tue, 8 Mar 2022 08:03:05 -0800 (PST) Received: from [192.168.1.10] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7BB13FA45; Tue, 8 Mar 2022 08:03:02 -0800 (PST) Message-ID: Date: Tue, 8 Mar 2022 17:03:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 From: Dietmar Eggemann Subject: Re: [PATCH v3] topology: make core_mask include at least cluster_siblings To: Vincent Guittot , Will Deacon Cc: Darren Hart , LKML , Linux Arm , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Catalin Marinas , Peter Zijlstra , Barry Song , Valentin Schneider , "D . Scott Phillips" , Ilkka Koskinen , stable@vger.kernel.org References: <20220308103012.GA31267@willie-the-truck> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 08/03/2022 12:04, Vincent Guittot wrote: > On Tue, 8 Mar 2022 at 11:30, Will Deacon wrote: [...] >>> --- >>> 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. IMHO, if core_mask weight is 1, MC will be removed/degenerated anyway. This is what I get on my Ampere Altra (I guess I don't have the ACPI changes which would let to a CLS sched domain): # cat /sys/kernel/debug/sched/domains/cpu0/domain*/name DIE NUMA root@oss-altra01:~# zcat /proc/config.gz | grep SCHED_CLUSTER CONFIG_SCHED_CLUSTER=y >>> + */ >>> + 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? > > I would not say that I'm happy because this solution skews the core > cpu mask in order to abuse the scheduler so that it will remove a > wrong but useless level when it will build its domains. > But this works so as long as the maintainer are happy, I'm fine I do not have any better idea than this tweak here either in case the platform can't provide a cleaner setup. Maybe the following is easier to read but then we use '&cpu_topology[cpu].llc_sibling' in cpu_coregroup_mask() already ... @@ -617,6 +617,7 @@ EXPORT_SYMBOL_GPL(cpu_topology); const struct cpumask *cpu_coregroup_mask(int cpu) { const cpumask_t *core_mask = cpumask_of_node(cpu_to_node(cpu)); + const cpumask_t *cluster_mask = cpu_clustergroup_mask(cpu); /* Find the smaller of NUMA, core or LLC siblings */ if (cpumask_subset(&cpu_topology[cpu].core_sibling, core_mask)) { @@ -628,6 +629,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu) core_mask = &cpu_topology[cpu].llc_sibling; } + if (cpumask_subset(core_mask, cluster_mask)) + core_mask = cluster_mask; + return core_mask; } Reviewed-by: Dietmar Eggemann