Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3161137pxu; Mon, 19 Oct 2020 05:42:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxAFfqpo2dxqG8fMGTZbfjr3PT/yybZbRwat9O0ctrs0eqV3sbuWzBQPFnzpLFuRamjdas X-Received: by 2002:aa7:d28a:: with SMTP id w10mr18188567edq.192.1603111346396; Mon, 19 Oct 2020 05:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603111346; cv=none; d=google.com; s=arc-20160816; b=m3Pphizx9E4iFH2k46hexAQlQJSmgnf7j0IUXce7UVRsxxv97rSRIw6ziMTMxb+D+3 MD+uF3bSPDkSbzrOdOx2YsKqVOwpACcuy0GMboNRl68zZ+Op+k9S2sXCMjSOBdJQGBTz ZIq8DHEZ6QHpMlwkgWq7f3SHq/pSJRO6/l7zXwJRYEm1GK/BurZ2MaLmw37lCT+J/wfc cbSyPZ2Yxg+IsMlRYm6r17XqzaB1kC2B4zuThOOxb0BdKcmfhFn4CgrI371HjJq1pKuO iqjpNau7UBokSdPLhu6yuE6yxrBP9LMpzTSCHbbFbgujvAep4t8HhvIDTjf3xDhdDjMb IAvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=5CJXnu/PmM2emJ7gTvej91behzy+Kr9Vg/yH8K5rpmg=; b=l+PuOLEoFlfNcN/JliSmjvyXnd0iM4WSeG2pMJ4fht1iL0pk1q+aQwr3F0oZ3SqL38 LjsJ1zEdnBue83yCunvetddu8uEWxIJiDpLQgJaE9ztz6Y1N5xbrvZ5SV/Hzvza2yfmo CxnOzQ6D0n7A0qBfRploNr4MJ/OYC6jHJGQAk8q6+gRe7W9nSWamjkAQZBmPQ2QuSN1w I+DnSFT23W7AyBpyIPe/Ry6z3w7Hl0ArJhVNQsE3hcRfy36zcfGh295hqgYJ2Oj5STiJ /OVqQUGrnBAmQ1MIEqI+EwOm67v9YXYOUUys357D4eYn9JKa9+jC3AkRY7Mk7d13uxFK sl/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si7603897eju.453.2020.10.19.05.42.03; Mon, 19 Oct 2020 05:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727202AbgJSMke convert rfc822-to-8bit (ORCPT + 99 others); Mon, 19 Oct 2020 08:40:34 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2988 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727126AbgJSMkd (ORCPT ); Mon, 19 Oct 2020 08:40:33 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 43F26A2699A4B1467DC1; Mon, 19 Oct 2020 13:40:32 +0100 (IST) Received: from localhost (10.52.126.130) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 19 Oct 2020 13:40:31 +0100 Date: Mon, 19 Oct 2020 13:38:36 +0100 From: Jonathan Cameron To: Brice Goglin CC: , , , , Len Brown , Greg Kroah-Hartman , Sudeep Holla , , Will Deacon , Subject: Re: [RFC PATCH] topology: Represent clusters of CPUs within a die. Message-ID: <20201019123836.00004877@Huawei.com> In-Reply-To: <942b4d68-8d19-66d8-c84b-d17eba837e9a@inria.fr> References: <20201016152702.1513592-1-Jonathan.Cameron@huawei.com> <942b4d68-8d19-66d8-c84b-d17eba837e9a@inria.fr> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.52.126.130] X-ClientProxiedBy: lhreml711-chm.china.huawei.com (10.201.108.62) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 19 Oct 2020 12:00:15 +0200 Brice Goglin wrote: > Le 16/10/2020 ? 17:27, Jonathan Cameron a ?crit?: > > Both ACPI and DT provide the ability to describe additional layers of > > topology between that of individual cores and higher level constructs > > such as the level at which the last level cache is shared. > > In ACPI this can be represented in PPTT as a Processor Hierarchy > > Node Structure [1] that is the parent of the CPU cores and in turn > > has a parent Processor Hierarchy Nodes Structure representing > > a higher level of topology. > > > > For example Kunpeng 920 has clusters of 4 CPUs. These do not share > > any cache resources, but the interconnect topology is such that > > the cost to transfer ownership of a cacheline between CPUs within > > a cluster is lower than between CPUs in different clusters on the same > > die. Hence, it can make sense to deliberately schedule threads > > sharing data to a single cluster. > > > > This patch simply exposes this information to userspace libraries > > like hwloc by providing cluster_cpus and related sysfs attributes. > > PoC of HWLOC support at [2]. > > > > Note this patch only handle the ACPI case. > > > > Special consideration is needed for SMT processors, where it is > > necessary to move 2 levels up the hierarchy from the leaf nodes > > (thus skipping the processor core level). > > > > Currently the ID provided is the offset of the Processor > > Hierarchy Nodes Structure within PPTT. Whilst this is unique > > it is not terribly elegant so alternative suggestions welcome. > > > > Note that arm64 / ACPI does not provide any means of identifying > > a die level in the topology but that may be unrelate to the cluster > > level. > > > > RFC questions: > > 1) Naming > > 2) Related to naming, do we want to represent all potential levels, > > or this enough? On Kunpeng920, the next level up from cluster happens > > to be covered by llc cache sharing, but in theory more than one > > level of cluster description might be needed by some future system. > > 3) Do we need DT code in place? I'm not sure any DT based ARM64 > > systems would have enough complexity for this to be useful. > > 4) Other architectures? Is this useful on x86 for example? > > > Hello Jonathan Hi Brice, > > Intel has CPUID registers to describe "tiles" and "modules" too (not > used yet as far as I know). The list of levels could become quite long > if any processor ever exposes those. If having multiple cluster levels > is possible, maybe it's time to think about introducing some sort of > generic levels: I've been wondering what tiles and modules are... Looking back and naming over time, I'm going to guess tiles are the closest to the particular case I was focusing on here. > > cluster0_id = your cluster_id > cluster0_cpus/cpulist = your cluster_cpus/cpulis > cluster0_type = would optionally contain hardware-specific info such as > "module" or "tile" on x86 > cluster_levels = 1 I wondered exactly the same question. At this point, perhaps we just statically introduce an 0 index, but with the assumption we would extend that as / when necessary in future. > > hwloc already does something like this for some "rare" levels such as > s390 book/drawers (by the way, thanks a lot for the hwloc PoC, very good > job), we call them "Groups" instead of "cluster" above. Given we definitely have a 'naming' issue here, perhaps group0 etc is a good generic choice? > > However I don't know if the Linux scheduler would like that. Is it > better to have 10+ levels with static names, or a dynamic number of levels? So far our 'general' experiments with adding clusters into the kernel scheduler have been a typical mixed bunch. Hence the proposal to just expose the structure to userspace where we should at least know what the workload is. Hopefully we'll gain more experience with using it and use that to drive possible kernel scheduler changes. > > Brice Thanks, Jonathan