Received: by 10.223.185.116 with SMTP id b49csp2485785wrg; Sat, 24 Feb 2018 22:19:46 -0800 (PST) X-Google-Smtp-Source: AH8x2277N0/zDT+VEDWJ2GYLy2ESqEJWQjh1QT8tkydLNgbOCFnP5KSZseDHpOZllhx+MXQdTC81 X-Received: by 2002:a17:902:7808:: with SMTP id p8-v6mr6938507pll.161.1519539586635; Sat, 24 Feb 2018 22:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519539586; cv=none; d=google.com; s=arc-20160816; b=RPn0op9XF50AE2+L7qGF5/PK8A84hPwRAp/cUk+IjZ8qzlkglY/pjnFls+d/mWlr9A CozbdRVtQ/7tkqHgv8tmQj+ylxItFvH2Ji70gbRe3wwKGCnJdDH+N2CYfHqi5+cHoNlR rIRaB7QGXm2CBgpW6JE27aGSuqgqSXkUEJc5hXRbV4vvWHHPXDvvctwvR7mQt77bHyXR bszcACfad0WuhMs0K99zcxzkToaMEnY/7H1774xl3WVi6dVbdBdVdJo0WSLIk9/BWL+N GK7x2lHnFq8OZkcHQBEHtyEBwmnQbgQB+AKbsPfaCkhHII1HxtXndRQqj91DQ2XbNHYH nqyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=xW4DpNRQZWRVSMr2snBuZxIxXdd8HcSg0SFeKJtw+Uc=; b=KE7ElSXxKwxB/vCAqAvckoWRCAENCLKT8z12B80rVTzNv6Kp8wVmfdbvZASMAJiL3h PkW1+mv5pkmCHGeSldcmDucY2LDOu4qTryCTVQPy15SKlikJHvuBC3VhfX14sI4bASGF qwd0g2QX1UOZZhaHu9l3N2JdKe41wnXYd2qI5uRQ4ACZlhpmxUiW2KFGHReaFThYSou7 34SHrWnaU0h2jZmF8xgD6l4l4HR4bJqEJFDhnxP/XQ0Tf4JPv0pAbN1dMGSt1BsLC48O m9jbAJLFfRc1H4C2mI+PnprWZYGFHy1eXPxjDGid6vCiq8m43CwTtL0s+PyZgtBaQCNi cnRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=WvmPpOcA; dkim=pass header.i=@codeaurora.org header.s=default header.b=fZ0Nl0CW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si4758103plm.590.2018.02.24.22.19.21; Sat, 24 Feb 2018 22:19:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=WvmPpOcA; dkim=pass header.i=@codeaurora.org header.s=default header.b=fZ0Nl0CW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751487AbeBYGSW (ORCPT + 99 others); Sun, 25 Feb 2018 01:18:22 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:37296 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722AbeBYGSU (ORCPT ); Sun, 25 Feb 2018 01:18:20 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C4AFF60B67; Sun, 25 Feb 2018 06:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519539499; bh=iNIKc3bCPKtcwRIZvWj1f3pvg3HfwiKtF+57D9KDMoc=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=WvmPpOcATuoC+9BsJYoWEwFXWnsSvekk2NTTwqA8G8ujWChfzdzI4GaofW0SQHZul /nYzkuzbNUkyZEdjYH98hnLLfNpBF88zlSx5pCx5cuBD7Z563px6Lu53JiATO2g0KX cXCutwvGtzw6jgnenCBcdAa8eyzK34H+gA76KIGI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from vkilari (unknown [183.82.16.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: vkilari@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9C5386070A; Sun, 25 Feb 2018 06:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519539486; bh=iNIKc3bCPKtcwRIZvWj1f3pvg3HfwiKtF+57D9KDMoc=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=fZ0Nl0CWZTNml9GuHOXNNzsBEvLcm5xNBZkY12FEIGHqYG2xd4xZaV3FVap5kWOEx /Hx1mIZpnOQrpdtYPrWmpu7Yo88JC4aHe3VE++guJjQ1bEw2IryW3DemPvNacLmMYF C+jvP25dXbVlHi62661x9h7apdAYdwJPDOj5Nplk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9C5386070A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vkilari@codeaurora.org From: To: "'Xiongfeng Wang'" , "'Lorenzo Pieralisi'" , "'Jeremy Linton'" Cc: , , , , "'Juri Lelli'" , , , , , , , , , , , , , , , , References: <20180113005920.28658-1-jeremy.linton@arm.com> <20180113005920.28658-12-jeremy.linton@arm.com> <928cb0c9-1d7a-3d0c-0538-a8bb0e2a86b1@huawei.com> <20180223110238.GB20461@e107981-ln.cambridge.arm.com> <2d248f08-79b6-d5e2-7e34-31a21efcdc07@huawei.com> In-Reply-To: <2d248f08-79b6-d5e2-7e34-31a21efcdc07@huawei.com> Subject: RE: [PATCH v6 11/12] arm64: topology: enable ACPI/PPTT based CPU topology Date: Sun, 25 Feb 2018 11:47:41 +0530 Message-ID: <010a01d3ae00$650e10d0$2f2a3270$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Content-Language: en-us Thread-Index: AQLO+zR2kwrPLwvCwj0J+M+ZfGHj3wJBWR5AAl6M0DEB/Pj25wIFYvsJAjmjJPWhZyiIsA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > -----Original Message----- > From: linux-arm-kernel [mailto:linux-arm-kernel-bounces@lists.infradead.org] > On Behalf Of Xiongfeng Wang > Sent: Saturday, February 24, 2018 8:36 AM > To: Lorenzo Pieralisi ; Jeremy Linton > > Cc: mark.rutland@arm.com; Jonathan.Zhang@cavium.com; > Jayachandran.Nair@cavium.com; catalin.marinas@arm.com; Juri Lelli > ; gregkh@linuxfoundation.org; jhugo@codeaurora.org; > rjw@rjwysocki.net; linux-pm@vger.kernel.org; will.deacon@arm.com; linux- > kernel@vger.kernel.org; morten.rasmussen@arm.com; linux- > acpi@vger.kernel.org; viresh.kumar@linaro.org; hanjun.guo@linaro.org; > sudeep.holla@arm.com; austinwc@codeaurora.org; vkilari@codeaurora.org; > ahs3@redhat.com; linux-arm-kernel@lists.infradead.org; lenb@kernel.org > Subject: Re: [PATCH v6 11/12] arm64: topology: enable ACPI/PPTT based CPU > topology > > > Hi, > On 2018/2/23 19:02, Lorenzo Pieralisi wrote: > > On Thu, Jan 25, 2018 at 09:56:30AM -0600, Jeremy Linton wrote: > >> Hi, > >> > >> On 01/25/2018 06:15 AM, Xiongfeng Wang wrote: > >>> Hi Jeremy, > >>> > >>> I have tested the patch with the newest UEFI. It prints the below error: > >>> > >>> [ 4.017371] BUG: arch topology borken > >>> [ 4.021069] BUG: arch topology borken > >>> [ 4.024764] BUG: arch topology borken > >>> [ 4.028460] BUG: arch topology borken > >>> [ 4.032153] BUG: arch topology borken > >>> [ 4.035849] BUG: arch topology borken > >>> [ 4.039543] BUG: arch topology borken > >>> [ 4.043239] BUG: arch topology borken > >>> [ 4.046932] BUG: arch topology borken > >>> [ 4.050629] BUG: arch topology borken > >>> [ 4.054322] BUG: arch topology borken > >>> > >>> I checked the code and found that the newest UEFI set PPTT > >>> physical_package_flag on a physical package node and the NUMA domain > (SRAT domains) starts from the layer of DIE. (The topology of our board is core- > >cluster->die->package). > >> > >> I commented about that on the EDK2 mailing list. While the current > >> spec doesn't explicitly ban having the flag set multiple times > >> between the leaf and the root I consider it a "bug" and there is an > >> effort to clarify the spec and the use of that flag. > >>> > >>> When the kernel starts to build sched_domain, the multi-core > >>> sched_domain contains all the cores within a package, and the lowest > >>> NUMA sched_domain contains all the cores within a die. But the kernel > requires that the multi-core sched_domain should be a subset of the lowest > NUMA sched_domain, so the BUG info is printed. > >> > >> Right. I've mentioned this problem a couple of times. > >> > >> At at the moment, the spec isn't clear about how the proximity domain > >> is detected/located within the PPTT topology (a node with a 1:1 > >> correspondence isn't even required). As you can see from this patch > >> set, we are making the general assumption that the proximity domains > >> are at the same level as the physical socket. This isn't ideal for > >> NUMA topologies, like the D05, that don't align with the physical socket. > >> > >> There are efforts underway to clarify and expand upon the > >> specification to deal with this general problem. The simple solution > >> is another flag (say PPTT_PROXIMITY_DOMAIN which would map to the D05 > >> die) which could be used to find nodes with 1:1 correspondence. At > >> that point we could add a fairly trivial patch to correct just the > >> scheduler topology without affecting the rest of the system topology code. > > > > I think Morten asked already but isn't this the same end result we end > > up having if we remove the DIE level if NUMA-within-package is > > detected (instead of using the default_topology[]) and we create our > > own ARM64 domain hierarchy (with DIE level removed) through > > set_sched_topology() accordingly ? To overcome this, on x86 as well the DIE level is removed when NUMA-within-package is detected with this patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/ar ch/x86/kernel/smpboot.c?h=v4.16-rc2&id=8f37961cf22304fb286c7604d3a7f6104dcc1 283 Solving with PPTT would be clean approach instead of overriding default_topology[] > > > > Put it differently: do we really need to rely on another PPTT flag to > > collect this information ? > > > > I can't merge code that breaks a platform with legitimate firmware > > bindings. > > I think we really need another PPTT flag, from which we can get information > about how to build a multi-core sched_domain. I think only cache-sharing > information is not enough to get information about how to build a multi-core > shced_domain. > > How about this? We assume the upper layer of the lowest layer to be multi- > core layer. > After that flag is added into ACPI specs, we add another patch to adapt to the > change. > > Thanks, > Xiongfeng > > > > > Thanks, > > Lorenzo > > > >> > >>> > >>> If we modify the UEFI to make NUMA sched_domain start from the layer > >>> of package, then all the topology information within the package > >>> will be discarded. I think we need to build the multi-core sched_domain > using the cores within the cluster instead of the cores within the package. I > think that's what 'multi-core' means. Multi cores form a cluster. I guess. > >>> If we build the multi-core sched_domain using the cores within a > >>> cluster, I think we need to add fields in struct cpu_topology to record which > cores are in each cluster. > >> > >> The problem is that there isn't a generic way to identify which level > >> of cache sharing is the "correct" top layer MC domain. For one system > >> cluster might be appropriate, for another it might be the highest > >> caching level within a socket, for another is might be a something in > >> between or a group of clusters or LLCs.. > >> > >> Hence the effort to standardize/guarantee a PPTT node that exactly > >> matches a SRAT domain. With that, each SOC/system provider has > >> clearly defined method for communicating where they want the proximity > domain information to begin. > >> > >> Thanks, > >> > >>> > >>> > >>> Thanks, > >>> Xiongfeng > >>> > >>> On 2018/1/13 8:59, Jeremy Linton wrote: > >>>> Propagate the topology information from the PPTT tree to the > >>>> cpu_topology array. We can get the thread id, core_id and > >>>> cluster_id by assuming certain levels of the PPTT tree correspond > >>>> to those concepts. The package_id is flagged in the tree and can be > >>>> found by calling find_acpi_cpu_topology_package() which terminates > >>>> its search when it finds an ACPI node flagged as the physical > >>>> package. If the tree doesn't contain enough levels to represent all > >>>> of the requested levels then the root node will be returned for all > >>>> subsequent levels. > >>>> > >>>> Cc: Juri Lelli > >>>> Signed-off-by: Jeremy Linton > >>>> --- > >>>> arch/arm64/kernel/topology.c | 46 > >>>> +++++++++++++++++++++++++++++++++++++++++++- > >>>> 1 file changed, 45 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/arch/arm64/kernel/topology.c > >>>> b/arch/arm64/kernel/topology.c index 7b06e263fdd1..ce8ec7fd6b32 > >>>> 100644 > >>>> --- a/arch/arm64/kernel/topology.c > >>>> +++ b/arch/arm64/kernel/topology.c > >>>> @@ -11,6 +11,7 @@ > >>>> * for more details. > >>>> */ > >>>> +#include > >>>> #include > >>>> #include > >>>> #include > >>>> @@ -22,6 +23,7 @@ > >>>> #include > >>>> #include > >>>> #include > >>>> +#include > >>>> #include > >>>> #include > >>>> @@ -300,6 +302,46 @@ static void __init reset_cpu_topology(void) > >>>> } > >>>> } > >>>> +#ifdef CONFIG_ACPI > >>>> +/* > >>>> + * Propagate the topology information of the > >>>> +processor_topology_node tree to the > >>>> + * cpu_topology array. > >>>> + */ > >>>> +static int __init parse_acpi_topology(void) { > >>>> + bool is_threaded; > >>>> + int cpu, topology_id; > >>>> + > >>>> + is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK; > >>>> + > >>>> + for_each_possible_cpu(cpu) { > >>>> + topology_id = find_acpi_cpu_topology(cpu, 0); > >>>> + if (topology_id < 0) > >>>> + return topology_id; > >>>> + > >>>> + if (is_threaded) { > >>>> + cpu_topology[cpu].thread_id = topology_id; > >>>> + topology_id = find_acpi_cpu_topology(cpu, 1); > >>>> + cpu_topology[cpu].core_id = topology_id; > >>>> + topology_id = find_acpi_cpu_topology_package(cpu); > >>>> + cpu_topology[cpu].package_id = topology_id; > >>>> + } else { > >>>> + cpu_topology[cpu].thread_id = -1; > >>>> + cpu_topology[cpu].core_id = topology_id; > >>>> + topology_id = find_acpi_cpu_topology_package(cpu); > >>>> + cpu_topology[cpu].package_id = topology_id; > >>>> + } > >>>> + } > >>>> + > >>>> + return 0; > >>>> +} > >>>> + > >>>> +#else > >>>> +static inline int __init parse_acpi_topology(void) { > >>>> + return -EINVAL; > >>>> +} > >>>> +#endif > >>>> void __init init_cpu_topology(void) { @@ -309,6 +351,8 @@ void > >>>> __init init_cpu_topology(void) > >>>> * Discard anything that was parsed if we hit an error so we > >>>> * don't use partial information. > >>>> */ > >>>> - if (of_have_populated_dt() && parse_dt_topology()) > >>>> + if ((!acpi_disabled) && parse_acpi_topology()) > >>>> + reset_cpu_topology(); > >>>> + else if (of_have_populated_dt() && parse_dt_topology()) > >>>> reset_cpu_topology(); > >>>> } > >>>> > >>> > >> > > > > . > > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel