From patchwork Wed Aug 21 14:52:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 171974 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1080021ily; Wed, 21 Aug 2019 07:53:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqztl1PPFuuzAsKdUNv+UjNlFWsQzW9FjhoyybSUm2jglJkpotI5AAtKWuc4fi4pUZ+0UdOP X-Received: by 2002:a65:6093:: with SMTP id t19mr22829289pgu.79.1566399198656; Wed, 21 Aug 2019 07:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566399198; cv=none; d=google.com; s=arc-20160816; b=OmqgOMj4FD4tdDkn/tHn2sgbJ6c+pYjVquNGzChbKpbSYB0IvM4QShedvObC8qoUei 7+RLkHKyg3O2TbX0VRLSy6xhrliBMJyws5mOm81L0GMw+wMaTUlWUxo6RXscE5zanNa7 85iNR8XeXpqrAHj52CalOCHsmJf0Fg2V/IpT9wuEak+Otk//IFIUlbmESN6kRvq+mjR+ syjPeBHh3dG0iC3cGgGlmEmjO2fg0dcK3Osxm7kvKJv5BgiqNyxGdmhIwMcmMyKvdc4h jBXLIcrddMjy6zSZNaXiES35MZVnIrsHDIdFke3vMvpY7f4v4RxbhXTnoIku7lbfKYJn 4umw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=98KNHLEWx93o5cfmiZ++oJ/q2LSG5KoYeBcjXdeebZg=; b=XRN1uz80ZAEOsqcgztWpmei7kcBcemEKN9zlpr76Qi6Ek0xfLQiqnPg3myOojEY7YJ ZwaW/H4hr/Wip9TOtP7/QC4wxLMDLl4G448luJ1qXl1fqBYvB8xOC52IdC5r9aOou2Tj /zlSsuJAh8sohvotuZI2k1EhXizBO/yGGpfx0+CPEX9/Jk3dYHwZxInvZWIB85JpKfSW PuG6oOv1/ImPyPE+s18D+pIBCYWVPOwKknKre55kUKwKVjhYFZYgA0nPfUEEN9dwOJ5x 8+g6LKiINTN9240bsLuwP6knE/f7dujLQMOm4WR6o3AX0cLwknOu/r3HngMTm1vTd4HB xuNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 u17si14157541pgg.204.2019.08.21.07.53.18; Wed, 21 Aug 2019 07:53:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727926AbfHUOxR (ORCPT + 7 others); Wed, 21 Aug 2019 10:53:17 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4752 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727696AbfHUOxQ (ORCPT ); Wed, 21 Aug 2019 10:53:16 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A01EA1FB20CC1D5D76A0; Wed, 21 Aug 2019 22:53:11 +0800 (CST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Wed, 21 Aug 2019 22:53:04 +0800 From: Jonathan Cameron To: , , , CC: Keith Busch , , "Rafael J . Wysocki" , , Andrew Morton , Dan Williams , Jonathan Cameron Subject: [PATCH 2/4] arm64: Support Generic Initiator only domains Date: Wed, 21 Aug 2019 22:52:40 +0800 Message-ID: <20190821145242.2330-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821145242.2330-1-Jonathan.Cameron@huawei.com> References: <20190821145242.2330-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The one thing that currently needs doing from an architecture point of view is associating the GI domain with its nearest memory domain. This allows all the standard NUMA aware code to get a 'reasonable' answer. A clever driver might elect to do load balancing etc if there are multiple host / memory domains nearby, but that's a decision for the driver. Signed-off-by: Jonathan Cameron --- arch/arm64/kernel/smp.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.20.1 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 018a33e01b0e..7c11bc6cccf2 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -711,6 +711,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) { int err; unsigned int cpu; + unsigned int node; unsigned int this_cpu; init_cpu_topology(); @@ -749,6 +750,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) set_cpu_present(cpu, true); numa_store_cpu_info(cpu); } + + /* + * Walk the numa domains and set the node to numa memory reference + * for any that are Generic Initiator Only. + */ + for_each_node_state(node, N_GENERIC_INITIATOR) + set_gi_numa_mem(node, local_memory_node(node)); } void (*__smp_cross_call)(const struct cpumask *, unsigned int); From patchwork Wed Aug 21 14:52:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 171977 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1080247ily; Wed, 21 Aug 2019 07:53:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3eL/EyoB9cseDIQRvkCcJ42FRYS7I728UA9ZKDGoGKw4gVSypm+0hr+8EsVY+M+qPGmcC X-Received: by 2002:a63:e54:: with SMTP id 20mr28901651pgo.244.1566399212261; Wed, 21 Aug 2019 07:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566399212; cv=none; d=google.com; s=arc-20160816; b=E4w9vEGhZqYkZiwgdhmFAA3ZowS3ZOCtuoDKk/6zRArnbwBTQt25SACST3fB+JL0gU nC0yEeJLMYrYEz8foHnLUlS3dP0S3DtO23a0/kEwIsOUzuVuJmIrAfuqdoAEEZnql/hX LGnfai6pBu3dN0V5cZ53o70IYc/ix5svO8TlZrbP6zNDxnoK/FEQypa9x+I+3Bu1Ieu8 DTvNkWk1C9IrOAk4805Odh1PYZHLAifrf+qMssoxtw6KJ9wevRTpWe51rBL5vWz74Jib QhbTm3qP3nSRCEfrEL24tPRUql3+PHtn1b5zlIveJgyXmEYfzublB2uHFntiAw0Wz3+G epcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6ZuX1RE1LZRZez2nbpNzANkKw6TrWwmQk3z8JQFmjkw=; b=f6XGhRVSb4cy5UkBvpYtTrzauPcbHW6yY7GfBUIrcUexboAY38VCcBZaB7/A5ltOCk 5dUTvBrjks6LiBr/18jO9QA5zPBJ0oUm+Ivgw4lsTbnrQ7C9pJib6cTCgAQIqQfdjCvL qlQeYG8fEHEJC0dTXVZIgBOFJgTW3l4yqjbkPzJb1ZTRAqTKfSo4dk1aFQKHPBspGR1k bWJvX/KQ5nxN2i0x4tvtHah97ejgcr6XvvEFbSmceIhavEh8e0cNI9MrJF4QtqIeC1M8 EZ8VnjELI6mKON9HmBkMWOKp15KiWm+2fR83DJgjVNVQduOip18nhGhZlXCH/HAUk5HL NSrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 d37si15298906pla.165.2019.08.21.07.53.32; Wed, 21 Aug 2019 07:53:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727178AbfHUOxb (ORCPT + 7 others); Wed, 21 Aug 2019 10:53:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5182 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727864AbfHUOxb (ORCPT ); Wed, 21 Aug 2019 10:53:31 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B35C041EFBB7AE0B4B9E; Wed, 21 Aug 2019 22:53:16 +0800 (CST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Wed, 21 Aug 2019 22:53:08 +0800 From: Jonathan Cameron To: , , , CC: Keith Busch , , "Rafael J . Wysocki" , , Andrew Morton , Dan Williams , Jonathan Cameron Subject: [PATCH 3/4] x86: Support Generic Initiator only proximity domains Date: Wed, 21 Aug 2019 22:52:41 +0800 Message-ID: <20190821145242.2330-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821145242.2330-1-Jonathan.Cameron@huawei.com> References: <20190821145242.2330-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Done in a somewhat different fashion to arm64. Here the infrastructure for memoryless domains was already in place. That infrastruture applies just as well to domains that also don't have a CPU, hence it works for Generic Initiator Domains. In common with memoryless domains we only register GI domains if the proximity node is not online. If a domain is already a memory containing domain, or a memoryless domain there is nothing to do just because it also contains a Generic Initiator. Signed-off-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 2 ++ arch/x86/kernel/setup.c | 1 + arch/x86/mm/numa.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+) -- 2.20.1 diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index bbfde3d2662f..f631467272a3 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -62,12 +62,14 @@ extern void numa_clear_node(int cpu); extern void __init init_cpu_to_node(void); extern void numa_add_cpu(int cpu); extern void numa_remove_cpu(int cpu); +extern void init_gi_nodes(void); #else /* CONFIG_NUMA */ static inline void numa_set_node(int cpu, int node) { } static inline void numa_clear_node(int cpu) { } static inline void init_cpu_to_node(void) { } static inline void numa_add_cpu(int cpu) { } static inline void numa_remove_cpu(int cpu) { } +static inline void init_gi_nodes(void) { } #endif /* CONFIG_NUMA */ #ifdef CONFIG_DEBUG_PER_CPU_MAPS diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index bbe35bf879f5..8c368279624d 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1265,6 +1265,7 @@ void __init setup_arch(char **cmdline_p) prefill_possible_map(); init_cpu_to_node(); + init_gi_nodes(); io_apic_init_mappings(); diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index e6dad600614c..2f561344d590 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -733,6 +733,20 @@ static void __init init_memory_less_node(int nid) */ } +/* + * Generic Initiator Nodes may have neither CPU nor Memory. + * At this stage if either of the others were present we would + * already be online. + */ +void __init init_gi_nodes(void) +{ + int nid; + + for_each_node_state(nid, N_GENERIC_INITIATOR) + if (!node_online(nid)) + init_memory_less_node(nid); +} + /* * Setup early cpu_to_node. *