From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 018E2C433F5 for ; Tue, 8 Mar 2022 11:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l35pVmnlXCRLjNw0G2Ax5VSgg71tbSeDXL5US27bKjU=; b=CxQkb+IsWA6rKW wMJ9crfvmx4nqqpuvj0tM6Obgs9vzHFrvQgOASsGJgcSdWOXib/gBlzB3dVc5RoNhCUueFCIi+iM1 TgPZJOcRNRgYtg+v8OwQY9Dq+Et1P9uPTtcCI3fPXQS1Qan2Fl0OiLHR0QnRiLS4KEYMZXIXTlB4u A611BO9MOyZbO7L0AFrP2pNawkhXVa3+S493N+2Bk5uc78pDQcrRATkb5k5kqpXF/6DjOcjODiTkI hdtI+LU5n4cvo3U5gWqXt4+zFUvuo+oVdF2Cqw6Gf8LqKkkQjefvivoWnjGHRlTwW5UqwkpE+u7OI Qg4C2iRP+tZaMNai2L4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRXeR-0043RG-4T; Tue, 08 Mar 2022 11:05:11 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRXeM-0043Ob-9k for linux-arm-kernel@lists.infradead.org; Tue, 08 Mar 2022 11:05:08 +0000 Received: by mail-lf1-x135.google.com with SMTP id w27so31520065lfa.5 for ; Tue, 08 Mar 2022 03:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0HiFFHplwuG4zm1Rr+rVXkq22q8xtVPCcUR+EBSBuBs=; b=BGr5gudFns+UxCKjsQxhMavcMBe9ynwXAs/M919w79Ifw9WRIjpwGj4F5pQ2vd6aly /HhoIl7QqL2wCGyA9eRHQPlE9TogbzHwCrDLGc9T1w6gbmlPFxUM4f77j9qRk7pRb7ej qZfMJOVeyZPPbv2JLJ3nb2A/sOiWrjJVYtS80J0uHt5rJT99Bs9CC76H8JsnVBlrEZAp /g0K94ZDw5uakcvk+dZjWXFxIks/C2qJf9QVWf7+mhB+dtGkiDEPIZpXfytDq0OR8q61 DkXsC7v7eT2HofrRp2KgHHEb0uPWROHHLr7UQ/dipzdBxNYn0R6JQZpqk4VfUeXkLuRL At3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0HiFFHplwuG4zm1Rr+rVXkq22q8xtVPCcUR+EBSBuBs=; b=kD8U6QO0l1kcbe2bYRJGgpMfLxePRUj6m7hG7jRBjxLy+uFCn6oeIsNPW7caltIcL4 NgZiLVuN0JJJtziYzcHUa68zP03+TUhBZqROt9GhzgFva4khCADcO2Sy2gaQ3p1vP3KL Ih3DUzx4A65/t1kaCQiGLdPrppvTjqVwPFxDhVVQ6MymFrr3SjCKeONBF6xsvbnGm5VF ZQeEym/SmhnlXE/PAKkADVNXDe4kti72EU7p4RVtBMcZRAEoNumyTozgX18c+Ij4rr4d FtqKKd7sSvyH28Cu9+tAu3PRFUpONpiEC+LExOmeip7i1HQZLE9IsuGRwgbcEGej1n6G pAnw== X-Gm-Message-State: AOAM532ccyRO5HLR+Wv886GCpCZHeI5vCae21BT2q+csJdZef8fQFiT/ 0EYCERajfnt37V2UteSXGBuNkMjWXgA4PJigbRUvjQ== X-Google-Smtp-Source: ABdhPJzMSPfYAe3/8DHXx462DQKzkgcDKQrfjbA/wFGR/EONugZQ+vumURU7BkE6gCAGNvWN0MrFXJZkJinJj40S2gg= X-Received: by 2002:a05:6512:6ce:b0:448:46c6:b93e with SMTP id u14-20020a05651206ce00b0044846c6b93emr996065lff.46.1646737504364; Tue, 08 Mar 2022 03:05:04 -0800 (PST) MIME-Version: 1.0 References: <20220308103012.GA31267@willie-the-truck> In-Reply-To: <20220308103012.GA31267@willie-the-truck> From: Vincent Guittot Date: Tue, 8 Mar 2022 12:04:53 +0100 Message-ID: Subject: Re: [PATCH v3] topology: make core_mask include at least cluster_siblings To: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220308_030506_405031_062A8576 X-CRM114-Status: GOOD ( 31.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 8 Mar 2022 at 11:30, Will Deacon wrote: > > 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? 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 > > Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel