From patchwork Fri Mar 4 17:01:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darren Hart X-Patchwork-Id: 12769477 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 1B4F3C433EF for ; Fri, 4 Mar 2022 17:03:39 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=j1wTNxlAWHNiEvsFqCOw6Mi8FuGUCU2DGn8NlhVIQz0=; b=EEeb13iL3cr1dU Lqt8wCTCANnLvoF969Ih8f6l7Z3peD0mDIEKU8/AX5josnYkPnxRxtd8SxyiQTdXN5YExPpgUEqGe N1d+9WN2Z1Nt4aDKPW1snZL069xZjJJEjSePyPfNguxLNpRX7lfUvI6OEIM9eI9r6yG9m5/9obpjE rE1Mjd0zpN4PEMn22jQq/YUr+CH4UH72bQ1VKVKcS2yXDiVdPPgaLY/HM7q0f3tkd655/dFyIEShL aMI8FTypwf2nNP6d+7+DnDpyJlnFnm07XRUpCyD+ubgD2Wp6K+iYEY9tTthW/MNgf4UTmr38F0OoA dKhD6COyc7by5/AXAuvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQBJp-00BCmI-Ts; Fri, 04 Mar 2022 17:02:18 +0000 Received: from mail-co1nam11on20702.outbound.protection.outlook.com ([2a01:111:f400:7eab::702] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQBJl-00BCkh-Jq for linux-arm-kernel@lists.infradead.org; Fri, 04 Mar 2022 17:02:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YH2Vcw/ESC5Pcwk1nlP0oBFD1Xl4TOdiaW4rk+e2XCvQMgz0q/l+ps7eMXV64RUUMItOsre9nvMISyYspoImaJi1KJOR0hjAye6910XftULQ031hNeapfsqFBPtUoqWZuj7SRqGQSv76Lyqo1gCUcCzfgESVajl6Vkqtj1Ix7TjAhfMa2AFM1BvgBYIve/FudkmIfr8+C87gvrHU62hJJ/3Pbrak/OOk8Vd8QuSk01Ad3clSuMLBzUvl3QMs9k11VPgftxcqHsovdGc9+wmBw7t2xtfPB/exJlzKISi/p3OqYO5/VJwAl6UFergG79GpRaXYk3Fkb4D5k+e4temmTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cpBFqktRIFe/9as+w8aLeV5GSBCEloa5ICSwc+v5s1Q=; b=i42grKXoQqRiSX2hpIUZg3Rk4/1RxlbAkacAt9JxgxGkqgv2L8MuhwPRknQ1QOElnlc3pODMxyBn0YXF17UYynQ0Ihknl8ihUXrFQ3iNu/82ZUnM7IMi1CXBghHiii1OqFlbs8qS+gQYlmyfZq31qYA1azP4SgaH3aPSm80YeWnrbQOiUGHnaLql6mOHWLLXbzBfkIi3rqwr+8N7jvDIP0iPcQbJPPlsIFCi1IvFuXqu2rYuORpXbnsxlp8nxF12qsnDNWzZaKsKerH+maq4aBkV2wyxhgc+MEs8HC5oj8oDwDDLMLeMSTdpS46tL8fVEUv7wj+poO12aS2D0CK0Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cpBFqktRIFe/9as+w8aLeV5GSBCEloa5ICSwc+v5s1Q=; b=gIRxoHImVy3McPrlKzogkV6pfLXITX2BVgxgtVqv80af0Gg2JnUyZVdx8W1SE0S1SVb68qSviTXEI7S6UD4W2ChBS47zeFOCiMWPW21OzEM5Gsg/MOm5IOIGQ6NMOMCHeFWmj5bC1m5DEw2x9dEtvDqh49lzL+gJRYShw7WQQOg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SA0PR01MB6329.prod.exchangelabs.com (2603:10b6:806:ee::12) by SN6PR01MB4319.prod.exchangelabs.com (2603:10b6:805:b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Fri, 4 Mar 2022 17:02:07 +0000 Received: from SA0PR01MB6329.prod.exchangelabs.com ([fe80::f56a:e18f:b6c4:ddb5]) by SA0PR01MB6329.prod.exchangelabs.com ([fe80::f56a:e18f:b6c4:ddb5%7]) with mapi id 15.20.5038.017; Fri, 4 Mar 2022 17:02:07 +0000 From: Darren Hart To: LKML , Linux Arm Cc: 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 Subject: [PATCH v3] topology: make core_mask include at least cluster_siblings Date: Fri, 4 Mar 2022 09:01:36 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: CH2PR14CA0017.namprd14.prod.outlook.com (2603:10b6:610:60::27) To SA0PR01MB6329.prod.exchangelabs.com (2603:10b6:806:ee::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05718b07-81c6-4cce-6252-08d9fe00b642 X-MS-TrafficTypeDiagnostic: SN6PR01MB4319:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /5Czo2vrA/3pqgsKfoqtgzg30i5l9CLetc4x0N5smpLhy9R6xVxncdDYGoBKEZPSI/ALlj8KzJyLj3ULvNDAjag84cvY9wJUcJkIn7gdnXlvJYeIAaqQfJEFitzasfaIA6YE2EGCNsblF/KpremPVEtBVYKqPpj/1cAY269zwkWBJKSPdMd4D8XWwAAFQqJuwRri+CKwVo6cn/bRzihKufgCSW+0SskPEf93whADWVtRiFs3K2sLr+PXwYPKp3Za4C4NrdvO7BTLQkRN5A7jeeFSd8na+qsgBFF3dAPmEIh/TmlDv+4Iu5X9bFUSyO4KsGYZBr2WCvdh8tPBAXBTez98Hev0qM8S5vE/zcJkIP4Flp+D8FykQmLYZK7JdgcVrkj+8Iwy6AobpWeim0HY3B+aqUveAR6VDu6rLKgjwgECI8umi7/I1Mj1wRM0eBcCIhVIOjc78jhk5Am7+xWvoy1pDwvKW7cWb4raSg3pY5is1fq6eSoiJEdqnnAZNchopzG+HOF5mU2xqbgeu1Ir4xz8TAL/OVKmHfhhoV5e352qSfEwh7kI3vp9HkyFSRMFZ2k+g+COnobdLm/sJzY8BHKd3S8bQ3L42IZNRcC+wWczC8AjpfHKCBpwVw0qDQBZrsktzSm82k0NYB4hAJ1bfennDO8ofLKWoBf/42U02t+cp96LQgXWztiW5PrJR/H3z2otXTyCP4pM9a57UQ8MDA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA0PR01MB6329.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(2616005)(86362001)(7416002)(508600001)(110136005)(5660300002)(54906003)(83380400001)(6666004)(6506007)(52116002)(186003)(6486002)(316002)(26005)(66476007)(2906002)(8936002)(38350700002)(38100700002)(66946007)(4326008)(66556008)(8676002)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1ob9ql8Lkb5kqEZKAAOMRndlXB+EKO9IDhzOBQNWyQbj2QIVw6/sNaWXC1dwF9TX/E7I12m+8FIl3yMAfUFtBCKxshJQWvvjaePpkXQN5ef3Vp0HluLD/nDaIIiapytOBAkZ5h2nKemev2IpW2A4zne/9vf1rcOgBJIVSzfG3+0CKeajY74lqbrYB8xNqdMiD1Qyk2GGDAIydkAIJAKI89DduCtT+Cr+ilsbRPbNN0c+VIX+s0/VvtwEAZnuxjO+oEZ1IJ8DF+S8g8DMs76GxKw8BiP7bl5RUqwbbTggaugWD627lE4LMDQPzMtmTc7ImNx3vYyMLJ/sj9d/506UL9KYceiA0zayFAyAcow7MTFVFvYkT4SjwSdeHMkdeBbttlHqDjAbhvfUGcw3hTexQBlwQMMBoNiv6Hk4Y86Q1i81TLhXbZzcfK+lGszex+pt9c+ql0fePLdo1dZBz6TpHgjDqvTyJ3UBjNt7p/tMkc94wHTNFRkwiu7/N/PlDghjBVB/2QtttkpIrHZuiNUtY73T+keX7TNkWyCMCCkAE3DTt6fmO3/CT8FnL+MiDrJGhUCkXUoVCnLk5jGOQ99rmNMk9SfJ13ltnJ1oMjBs2ioOSYSLDeSUujvpNGUUIm5qBvIWwpPlEi+r38eEOt/G0A6yni2n6kPn8gY04iRubqH8nPCMA2/sq0so9e7gL3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Exchange-CrossTenant-Network-Message-Id: 05718b07-81c6-4cce-6252-08d9fe00b642 X-MS-Exchange-CrossTenant-AuthSource: SA0PR01MB6329.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2022 17:02:07.0594 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wGBEWuDYjMkKpRpFlUOZVhQxKAPZ3dIdUBwz8D42Fy6E5RG4i1FWgpBJvAxVDlKl3xK0hD42qy6FJXU7zeXq94CiNdK3WqNN6u7+ElX8dM0s+JbOpOgxUd9TL5Wg1uC4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR01MB4319 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220304_090213_721608_44E6AF24 X-CRM114-Status: GOOD ( 13.35 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Sudeep Holla Reviewed-by: Dietmar Eggemann Signed-off-by: Dietmar Eggemann Reported-by: kernel test robot Reported-by: kernel test robot 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; }