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 25A33C433EF for ; Thu, 17 Mar 2022 06:12:01 +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=tM0daaVUBqM0Fcqx7+OhmzjCfTLP7sYncFTfXoPMPY0=; b=HJzdj3k8Wmtyi0 q0Z7KCwVkNQ0U31pR/Jkrun4dJWUBQPjjM5EhcHw3aXp8+vnsveLO5Z3nhZzdMDz73dHIHQC02WFG TJW2GAa96r4Pp1NyJ/kO1ALRN0yFwdZ2Lw7NwZRt40FXheo6pa+NQyOB9xJQ4pX2U3qcvHuw5yqqY kCTAPAAysEaqMxogoaXR4E/vltzi/DbBwazpRUwLBzUQjV8XV8s09fYy+QlKk3v+ytIpana41y+9i 9qt4PnaHWSifIJBUuiD3EDJtydE8vfc43NniDeh88VMSuygKbICrxNOaBrb3xzdrDifE/y6FulYf4 zK7a/t9XXMCftlU9TrIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUjLK-00F2E6-8K; Thu, 17 Mar 2022 06:10:38 +0000 Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUjLG-00F2DN-Jg for linux-arm-kernel@lists.infradead.org; Thu, 17 Mar 2022 06:10:36 +0000 Received: by mail-yb1-xb31.google.com with SMTP id f38so8426419ybi.3 for ; Wed, 16 Mar 2022 23:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VR1NhHDBNWvTmsBrOFP6HJbH1ggjLumhtoOfnuEXWKI=; b=fu4hQROzacXnjEwEickLat//Rsxu9Mg2FA2L9aNavavKzn0dy5RrL8/eZ8e2nZF3bv fVW2xyaDnnwnoC0HgYzzqDf09WFCtCDRjgFQPFkVSLXbiDLAJVHOjSXybUgX449Pw7eT Q2hxqjQvk5Ms4SAMC/5SebEIT7IGnNuzkKTZkdxBvHReCBY5is2qRUoczKFGn7vFMt7Z xWnHJ8ehuz1yo5/EBZY95KOoGP0rjCQWHC5goHSZNz0f+2JZEbtWneqri0DerNcbrjxG 2N5hVUQwtat2x1LfXr9o4w4e017Jzf03v8joZg+SU0MHa/Zl03jK6+N/OuWOI0SwIRu4 s5yg== 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=VR1NhHDBNWvTmsBrOFP6HJbH1ggjLumhtoOfnuEXWKI=; b=BYCWz5zGN0Y8lA73sfzxeV2crrylpAHNKajetYvCR9be1oitYWHT1KsGR0NDyxmgCT kCY/BMHndflr3Glhgs0kCSawkbh7+wtzM4ramOdeYxitQlHcRjDECCgWVYR3gBx8nEIk IMh2hHfwT/9RRfG3yVdZVK+V/u9BKs25aaaAY9IBMxe7xirTjM5cOwm3jLLZFrFshaue MPvX1EBVvZ7zfMl5RMawLbI3Eymjoz/AKlFr3TcxwdcQ0fHt3RI9W6UU9EVIkSxelXdB woq+jQJ3VRI6NAAkM0e9kPJhVHMlZuouAi+FDoRHVLUJRTvB0NMEaLO2c35h6I+uMVWu w6KQ== X-Gm-Message-State: AOAM531vp3xNVT1FliSzKl8oZkIsoEWoMtJs+XN0zrJGexN4X+qryXGY Wk5JcpHzwS2miy9jH2HB3GqZ7o5QbR3+9hQJKOx2iCFN+YU= X-Google-Smtp-Source: ABdhPJzQqgUkL5oq0fuMuFq3UxEvtkIDlfD5E6dHXD5tJDQpxFdTJEw7TX0b6u6guiTEMMBwB50+ZyiQdXb65QCDXvs= X-Received: by 2002:a05:6902:13c1:b0:61d:969c:109c with SMTP id y1-20020a05690213c100b0061d969c109cmr3275233ybu.133.1647497432674; Wed, 16 Mar 2022 23:10:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Thu, 17 Mar 2022 19:10:19 +1300 Message-ID: Subject: Re: [PATCH v3] topology: make core_mask include at least cluster_siblings To: Darren Hart Cc: LKML , Linux Arm , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Peter Zijlstra , Vincent Guittot , 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-20220316_231034_707855_D31E9266 X-CRM114-Status: GOOD ( 27.15 ) 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 Sat, Mar 5, 2022 at 8:54 AM 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 Reviewed-by: Barry Song > --- > 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; > + > return core_mask; > } > > -- > 2.31.1 > Thanks Barry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel