From patchwork Mon Apr 15 17:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 162246 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3218345jan; Mon, 15 Apr 2019 10:49:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAeOxTzY9pDGcV1ErHM+260tVDdPQDNQl/htNnkoQcdBDIcTgz4nmrzKtDc8Bb5hY0EQWh X-Received: by 2002:aa7:8252:: with SMTP id e18mr76231526pfn.105.1555350599713; Mon, 15 Apr 2019 10:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555350599; cv=none; d=google.com; s=arc-20160816; b=JfDvHdxdv6ofy2ZAezcaJhHMTkBm8wyAWzV3sDhqRN1walna9ZlEQtc537LtDhdTiy i2RYsNX1NNZhxJ0RAn50Q5EpreoLstM0q8rByMhoZiPNHbJRp3QXn81msnOoqinw+H51 PczUSmSjN3wNUhwVqHyFzIj7Mkr4VfSpDKdjNZhRL3jhgM5JkTrZGmI3l1TSBZs4h1pG vG8rm9mwCsfsahHOaUkKf++YvB5twjMb8yLSaMCiEgdJ/3+T1e0IhPH88BjF6ruUDRdc naI6hW+vOUYyeysNwlPplSTwVYKslNxhjtARNIBbfTRJFuP5fclSA6+7YaYUWZMfA/0K b28w== 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=hF0XPxmSlriUa3biRRCnOMC8/O51OfJgLGjA5b/WPw4=; b=xiEMQQDq6V9QaT110V/8LmND9d5TbxHZz7SzxB1BnhJ7hf67MNPgbT61PMzeDlnXz3 W3W9uDfajT+l2+vpRTDIkcCuph0o0/4WJqumweS3l5kloKvZFh/L5E8Z4UvXVWJ0f2AY 2RC3j3ZdICFFw3OoSbGuWwWK7J0L+fRQtuf26roYO+NPqJkYCtnnWWwlLPMGQcucg5QA OwvyBcOWUbW9TcWuYnr15b8UaQ1KCerz9TipKzABEAhor7Oiqad2MXx23Z22MN7DwiFA J4Uy8Zh7tkyhWDGOMnOK+syRToBxOeJwwajswL8JVulkGcmlcMtgOwH0wopsisz9KSOg 93Kg== ARC-Authentication-Results: i=1; mx.google.com; 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 u70si35242118pgu.119.2019.04.15.10.49.59; Mon, 15 Apr 2019 10:49:59 -0700 (PDT) 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; 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 S1728086AbfDORty (ORCPT + 30 others); Mon, 15 Apr 2019 13:49:54 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6748 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727994AbfDORtt (ORCPT ); Mon, 15 Apr 2019 13:49:49 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E9F36BCDACFC859002AD; Tue, 16 Apr 2019 01:49:46 +0800 (CST) Received: from FRA1000014316.huawei.com (100.126.230.97) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 16 Apr 2019 01:49:40 +0800 From: Jonathan Cameron To: , , , CC: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Keith Busch , "Rafael J . Wysocki" , , Andrew Morton , "Jonathan Cameron" Subject: [PATCH 3/4 V3] x86: Support Generic Initiator only proximity domains Date: Tue, 16 Apr 2019 01:49:06 +0800 Message-ID: <20190415174907.102307-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> References: <20190415174907.102307-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [100.126.230.97] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.19.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 3d872a527cd9..240568c3ac60 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1245,6 +1245,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 dfb6c4df639a..5770d2dcad29 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -732,6 +732,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. *