From patchwork Thu Nov 19 00:38:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11916269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ECA4C5519F for ; Thu, 19 Nov 2020 00:39:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A86322266 for ; Thu, 19 Nov 2020 00:39:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1QF2HjWt"; dkim=permerror (0-bit key) header.d=wdc.com header.i=@wdc.com header.b="mlvuIpG5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A86322266 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5sZ/TWavDN2QoOPKVUtiPCauopSkh50obKbRPvzkg8A=; b=1QF2HjWtClSqkppOE6bEy6cYY mNFnAiSlC1Cbh/8HFRzD/Lt/Hin7HNcj8lqK10WqiFKj11hHxr5qc61dEbnPsbguXMayAjIxUnNxq NcO+u8GM6oTj/y3AxEgtKmE+5SPWa48jzEOyK/Fu8OCn3ZHgT2pYSsF1L5X/vPMoOIlmU+xUfGeje wZaZMG+qAQvN24hMrzrnUz0RjPLMJC3A+CveCu4ZfNaIpCeVerXOrCgc2I7xWMh6y+YdVIAWrvfUV SeKF6XGQ9SqaWzi6rp/ozTXzHx9zNGOmaDDiVu3pDO235jkzRxfBE6zR77mb6xS4FfgNNbYLL+uTc 9K7FQQi+A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyT-0006FG-6P; Thu, 19 Nov 2020 00:38:57 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyB-0006CB-Vi; Thu, 19 Nov 2020 00:38:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1605746719; x=1637282719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d3s03R5W/P58NhdkaX/eI00Uo7wjk8iETPnJwkMJkhA=; b=mlvuIpG5Csi2S9jMEBrK5H0Pqv3QfKOZ2RoILWSXuP4cgGn17aFyEgob kXXCkPNqJa3KUeBdB9YyS93TIC4E2Xv9rtvQDzJMCKvV/1A0n2o5H1Q8N YSGjVlz4a8MWLTNex3Nfu/GpyPHU4/sCk0IBmilXHnhfC3mWU6tg6/up1 0gXDpt49aJH+cT/Thg+g7dUSprI521fdn8dMJiyLkGcouxvb4O0ho9WRw ccmm/5FTCNctQa/fDab+2WKa+5XjIQFBQrne72u99/CrkiCgx0I44w7LE ZHOYswPM6pPFeE2tsYq/EQry+1ExNU3aVZ5aEaKLou4w+3FhD6CFY5lOX A==; IronPort-SDR: 2TsehCXqcKhhak48LykbdNEd2oFRzboeDnCV8t62Ts5wK7DYkTIy0Vt7ah5yT/j38Pdzb4BcEB qxgX9NK8mg9jwmCtzFCYjL+9quHuaz1prp4oE7HgyEFbmtOQVzF2bCvOqG0J4shETOHH9MeQ+F PsE6W3bwrmpY+BzvUdLQLlyABTG54rwFXLX2q3RWGtFczDQGs9r7RLoaBR7oPvkzSqojevmCAT PoWC3oRQiO5qN3S+Ho3vRik1u5efjXVcvE2EY4oV2LMHeOmCzfBVr/Q/hE1S8Mi73XCLyenLXS bW8= X-IronPort-AV: E=Sophos;i="5.77,488,1596470400"; d="scan'208";a="256529096" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Nov 2020 08:45:14 +0800 IronPort-SDR: tzQG3hhWzNf5fe9ifx4rVj5Dk9pCN3OxgVwygxOsU9hd0DKIBT9o1T32ZSySdUTg5rE0dmr0cB ktKT5MMClCXLW2UfwIyZ6X9KiAx5Sc+w/r7yphghgOOaoUaq2u5Mi0i7oTkwBKETs5zbYG0kdK sPBiiarv6JnyGPJR8Me1Y7SaDDHLLjJnf8FXpMcM0f15p/9tMFyvw+/W4lyIwbd1FmdpAGzfYp 0cXtelQjcmGbTye7fmHgvcrBSHQteQgotEhVO6l2qMsOciAqkfQ3/AKNMnN4Oco3ttGaQHPe5F f8QLJ4ZY57ewuZ9SS5x9MeCh Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 16:23:07 -0800 IronPort-SDR: kMFG0KK2onH84n/YkSW2DPfPkfqV7JvYk2Z5etWmTh2d7R7KjInZRcMAwOWbZEHwAnEqzVFKdd iNJwUDMIK5wbHtmnRSrxLxDjZOzwXabgibkBvwrE5wJ98CmTuT0t65rebDoe02B5oBWeZHTFUr rm+nRsbJP4SoOzmt0cA/8+n3bpEigbujo3ntO2GXoQJ46min3JyoPejqh2QhYWDdAKfNKQnN6+ krptl40k7Z7xvMRsTcDFH03NeFKiLVYT1XfzKdyJRXCEdINMe6psaBaq7FbEK1Gx6WwkGGxtzv pao= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.61.71]) by uls-op-cesaip02.wdc.com with ESMTP; 18 Nov 2020 16:38:35 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v5 1/5] arm64, numa: Change the numa init functions name to be generic Date: Wed, 18 Nov 2020 16:38:25 -0800 Message-Id: <20201119003829.1282810-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201119003829.1282810-1-atish.patra@wdc.com> References: <20201119003829.1282810-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_193840_227584_BBE3EC5F X-CRM114-Status: GOOD ( 19.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Rafael J. Wysocki" , Catalin Marinas , Jonathan Cameron , Atish Patra , linux-riscv@lists.infradead.org, Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Zhengyuan Liu , Baoquan He , Anup Patel , Daniel Lezcano , Steven Price , Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Palmer Dabbelt , Andrew Morton , Mike Rapoport Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a preparatory patch for unifying numa implementation between ARM64 & RISC-V. As the numa implementation will be moved to generic code, rename the arm64 related functions to a generic one. Signed-off-by: Atish Patra Acked-by: Catalin Marinas --- arch/arm64/include/asm/numa.h | 4 ++-- arch/arm64/kernel/acpi_numa.c | 12 ------------ arch/arm64/mm/init.c | 4 ++-- arch/arm64/mm/numa.c | 27 +++++++++++++++++++++++---- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index dd870390d639..ffc1dcdf1871 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -32,7 +32,7 @@ static inline const struct cpumask *cpumask_of_node(int node) } #endif -void __init arm64_numa_init(void); +void __init arch_numa_init(void); int __init numa_add_memblk(int nodeid, u64 start, u64 end); void __init numa_set_distance(int from, int to, int distance); void __init numa_free_distance(void); @@ -46,7 +46,7 @@ void numa_remove_cpu(unsigned int cpu); static inline void numa_store_cpu_info(unsigned int cpu) { } static inline void numa_add_cpu(unsigned int cpu) { } static inline void numa_remove_cpu(unsigned int cpu) { } -static inline void arm64_numa_init(void) { } +static inline void arch_numa_init(void) { } static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } #endif /* CONFIG_NUMA */ diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c index 7ff800045434..fdfecf0991ce 100644 --- a/arch/arm64/kernel/acpi_numa.c +++ b/arch/arm64/kernel/acpi_numa.c @@ -118,15 +118,3 @@ void __init acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) node_set(node, numa_nodes_parsed); } -int __init arm64_acpi_numa_init(void) -{ - int ret; - - ret = acpi_numa_init(); - if (ret) { - pr_info("Failed to initialise from firmware\n"); - return ret; - } - - return srat_disabled() ? -EINVAL : 0; -} diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 095540667f0f..977b47f6815a 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -407,10 +407,10 @@ void __init bootmem_init(void) max_pfn = max_low_pfn = max; min_low_pfn = min; - arm64_numa_init(); + arch_numa_init(); /* - * must be done after arm64_numa_init() which calls numa_init() to + * must be done after arch_numa_init() which calls numa_init() to * initialize node_online_map that gets used in hugetlb_cma_reserve() * while allocating required CMA size across online nodes. */ diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index a8303bc6b62a..0dae54ce7d43 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -13,7 +13,6 @@ #include #include -#include #include struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; @@ -445,16 +444,36 @@ static int __init dummy_numa_init(void) return 0; } +#ifdef CONFIG_ACPI_NUMA +static int __init arch_acpi_numa_init(void) +{ + int ret; + + ret = acpi_numa_init(); + if (ret) { + pr_info("Failed to initialise from firmware\n"); + return ret; + } + + return srat_disabled() ? -EINVAL : 0; +} +#else +static int __init arch_acpi_numa_init(void) +{ + return -EOPNOTSUPP; +} +#endif + /** - * arm64_numa_init() - Initialize NUMA + * arch_numa_init() - Initialize NUMA * * Try each configured NUMA initialization method until one succeeds. The * last fallback is dummy single node config encompassing whole memory. */ -void __init arm64_numa_init(void) +void __init arch_numa_init(void) { if (!numa_off) { - if (!acpi_disabled && !numa_init(arm64_acpi_numa_init)) + if (!acpi_disabled && !numa_init(arch_acpi_numa_init)) return; if (acpi_disabled && !numa_init(of_numa_init)) return; From patchwork Thu Nov 19 00:38:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11916277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FBBCC6369E for ; Thu, 19 Nov 2020 00:40:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A10022266 for ; Thu, 19 Nov 2020 00:40:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uNRp9hGI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="AbhKUj1F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A10022266 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sR6FRcHQvcVR2e+VXw95PM1aHFVfYbuR5Hx+PKnW9dY=; b=uNRp9hGI0zuSlElfGL0eLbxop wLvHTHJiV/dV46TIYVtGVHfy5kAs8+AtudZBlVh5kvgqIq0tzFulJS2S0GKKYsCkDjMbUgxTq+N5S kU6a0kSvAFsO5wBGyJiFskO4JSkTDieRkKMzzANmJ6yM7p5FPOXZXbsFFJRtduSgDUxOKtPgOusoJ SbVujgzVBRDzNKQTOte4PU+LKwJNqSCVzNK0zU+z65nFUbmAIIhGcBzIB6v4BXYROGP8rOyHwNIiC v/OdVC9hMXKLWfFVJGu/hceco1V5KomuDog8YdHBEyCBD30dD8S1zI2k2yuwT17fadieaPYfnl/tb jz/DaXOCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXye-0006GR-9M; Thu, 19 Nov 2020 00:39:08 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyC-0006CJ-8W; Thu, 19 Nov 2020 00:38:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1605746719; x=1637282719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CVYs1x4munyNqisP8RehwwbQA5Cb71FF96jIzbOi7/A=; b=AbhKUj1FPTu2nGPgzHw9Hx/RGxg1M4ktRa/zZbvKybj27UJau9M2velN dJUaJgxFIFc/dWKsdOtilB+tqc/03deflY1H2LGlx2AEMZUcv4sIN4JNZ vgUf9oxxvv3gdeK0FWnZlnOBLGv516d44/gK2nob6gaG4pFwXXiASROyQ eKHOHjvibOhsqXCJHoNucBlSSkxJEf71zjc6dsvhmiHqwD5ejB9KTZkzq 1g/mNVbhFiANEky9kMxu8aYjUzdubi7H2LMLBt5ncd23DiiA/Aq2me4mz rmRnbYH6SahFPzPZ02o3V7+FZUMBjjndth0BZ+kb397xjdLEB7KfA5BbI w==; IronPort-SDR: vj8lJKU5PyFUY8BbRnyhhCt2G1BFgpa1oLPTDwW4hlMnhbnQJKEYRJ7g9JdQnBLgWo+/NZy2P/ eY3nbpIa1fd3gKbyScgPrcpmdv2VeK4sYfZ/KcLBhB436rYK8sPIkvt/6cGwkk117NdU+DZPXI Qn/BWGaCPu+ga6dZU/RPA0Ry8E2rGU6t+7Z93IW3AVwAQrXxqy/aRD9FpWmrHyGzBs9WcjK01u 2CFq1m5To6veUTIjyFf0EgngFXvVcYZklsdvEcfiA0PeSJ6nhM2Q1TosbmukWaKc6IFTW+pIop Doo= X-IronPort-AV: E=Sophos;i="5.77,488,1596470400"; d="scan'208";a="256529104" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Nov 2020 08:45:16 +0800 IronPort-SDR: btwnLYP5hlGvylH1iJ1OfAJojOKjQgtTJZ+8kOBrbfg7LvRI+lLUGXX7zt6mVI+auamWXazKUk PHtqU0PGWDWi0LPspbXeQv8dnpuc7XjbVakLRlbmbYtp7WafGPrleGh/tGWaNJ+0RDCyGpVF29 9Dk8NvPGgqTAp/86eZea9DomtlxvcQ25Ag6tLZZCY5P1l3j9cPucdFfazXTj0YIvfa0QXxm307 NSIjhaUoGNAdgJa8dO5LIZxMmn65DeZJ01ImsIt0k8y/p0WT/ytYJIbHAE/M6EfEdO320JYapo 0XVEsGHqAM7zZLY7yS+L3chs Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 16:23:08 -0800 IronPort-SDR: BDXAQ107e5nYkAadgPiLauOOmd79ned360nZAHxRg1wqiOC/zpBY8BhFU2FaauwYJHhYLIv+56 5p73aQ+agfwfJGeI939XGTVy8JPxQ0R9cch3t00FYbfu7LPN3up5F91tzw0qyqAzGov27u3UrT KMxfCraJgnkQnbcH5DrdgSCNpYwEs4QsmsKFX8qn03H6338Z/QurNN1dB+5WsFiI0Z6WNxdsVj EGig8XMnfFNvXg+sCnPDiTfwzWRpUfDMza1GnqPhCSAvIRuAPuKuontM68ROv+b1jVb2aW7/p4 4kM= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.61.71]) by uls-op-cesaip02.wdc.com with ESMTP; 18 Nov 2020 16:38:36 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v5 2/5] numa: Move numa implementation to common code Date: Wed, 18 Nov 2020 16:38:26 -0800 Message-Id: <20201119003829.1282810-3-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201119003829.1282810-1-atish.patra@wdc.com> References: <20201119003829.1282810-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_193840_470362_38639898 X-CRM114-Status: GOOD ( 22.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Rafael J. Wysocki" , Catalin Marinas , Jonathan Cameron , Atish Patra , linux-riscv@lists.infradead.org, Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Zhengyuan Liu , Baoquan He , Anup Patel , Daniel Lezcano , Steven Price , Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Palmer Dabbelt , Andrew Morton , Mike Rapoport Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ARM64 numa implementation is generic enough that RISC-V can reuse that implementation with very minor cosmetic changes. This will help both ARM64 and RISC-V in terms of maintanace and feature improvement Move the numa implementation code to common directory so that both ISAs can reuse this. This doesn't introduce any function changes for ARM64. Signed-off-by: Atish Patra Acked-by: Jonathan Cameron Tested-by: Jonathan Cameron Acked-by: Catalin Marinas --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/numa.h | 48 +---------------- arch/arm64/mm/Makefile | 1 - drivers/base/Kconfig | 6 +++ drivers/base/Makefile | 1 + .../mm/numa.c => drivers/base/arch_numa.c | 0 include/asm-generic/numa.h | 52 +++++++++++++++++++ 7 files changed, 61 insertions(+), 48 deletions(-) rename arch/arm64/mm/numa.c => drivers/base/arch_numa.c (100%) create mode 100644 include/asm-generic/numa.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1515f6f153a0..4ebef80274fd 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -990,6 +990,7 @@ config HOTPLUG_CPU # Common NUMA Features config NUMA bool "NUMA Memory Allocation and Scheduler Support" + select GENERIC_ARCH_NUMA select ACPI_NUMA if ACPI select OF_NUMA help diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index ffc1dcdf1871..8c8cf4297cc3 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -3,52 +3,6 @@ #define __ASM_NUMA_H #include - -#ifdef CONFIG_NUMA - -#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) - -int __node_distance(int from, int to); -#define node_distance(a, b) __node_distance(a, b) - -extern nodemask_t numa_nodes_parsed __initdata; - -extern bool numa_off; - -/* Mappings between node number and cpus on that node. */ -extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; -void numa_clear_node(unsigned int cpu); - -#ifdef CONFIG_DEBUG_PER_CPU_MAPS -const struct cpumask *cpumask_of_node(int node); -#else -/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ -static inline const struct cpumask *cpumask_of_node(int node) -{ - if (node == NUMA_NO_NODE) - return cpu_all_mask; - - return node_to_cpumask_map[node]; -} -#endif - -void __init arch_numa_init(void); -int __init numa_add_memblk(int nodeid, u64 start, u64 end); -void __init numa_set_distance(int from, int to, int distance); -void __init numa_free_distance(void); -void __init early_map_cpu_to_node(unsigned int cpu, int nid); -void numa_store_cpu_info(unsigned int cpu); -void numa_add_cpu(unsigned int cpu); -void numa_remove_cpu(unsigned int cpu); - -#else /* CONFIG_NUMA */ - -static inline void numa_store_cpu_info(unsigned int cpu) { } -static inline void numa_add_cpu(unsigned int cpu) { } -static inline void numa_remove_cpu(unsigned int cpu) { } -static inline void arch_numa_init(void) { } -static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } - -#endif /* CONFIG_NUMA */ +#include #endif /* __ASM_NUMA_H */ diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile index 5ead3c3de3b6..cd60e4fed78f 100644 --- a/arch/arm64/mm/Makefile +++ b/arch/arm64/mm/Makefile @@ -6,7 +6,6 @@ obj-y := dma-mapping.o extable.o fault.o init.o \ obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_PTDUMP_CORE) += ptdump.o obj-$(CONFIG_PTDUMP_DEBUGFS) += ptdump_debugfs.o -obj-$(CONFIG_NUMA) += numa.o obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o obj-$(CONFIG_ARM64_MTE) += mteswap.o KASAN_SANITIZE_physaddr.o += n diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 8d7001712062..c5956c8845cc 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -210,4 +210,10 @@ config GENERIC_ARCH_TOPOLOGY appropriate scaling, sysfs interface for reading capacity values at runtime. +config GENERIC_ARCH_NUMA + bool + help + Enable support for generic NUMA implementation. Currently, RISC-V + and ARM64 uses it. + endmenu diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 41369fc7004f..7d65ea07de65 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_PINCTRL) += pinctrl.o obj-$(CONFIG_DEV_COREDUMP) += devcoredump.o obj-$(CONFIG_GENERIC_MSI_IRQ_DOMAIN) += platform-msi.o obj-$(CONFIG_GENERIC_ARCH_TOPOLOGY) += arch_topology.o +obj-$(CONFIG_GENERIC_ARCH_NUMA) += arch_numa.o obj-y += test/ diff --git a/arch/arm64/mm/numa.c b/drivers/base/arch_numa.c similarity index 100% rename from arch/arm64/mm/numa.c rename to drivers/base/arch_numa.c diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h new file mode 100644 index 000000000000..1a3ad6d29833 --- /dev/null +++ b/include/asm-generic/numa.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_GENERIC_NUMA_H +#define __ASM_GENERIC_NUMA_H + +#ifdef CONFIG_NUMA + +#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) + +int __node_distance(int from, int to); +#define node_distance(a, b) __node_distance(a, b) + +extern nodemask_t numa_nodes_parsed __initdata; + +extern bool numa_off; + +/* Mappings between node number and cpus on that node. */ +extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; +void numa_clear_node(unsigned int cpu); + +#ifdef CONFIG_DEBUG_PER_CPU_MAPS +const struct cpumask *cpumask_of_node(int node); +#else +/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ +static inline const struct cpumask *cpumask_of_node(int node) +{ + if (node == NUMA_NO_NODE) + return cpu_all_mask; + + return node_to_cpumask_map[node]; +} +#endif + +void __init arch_numa_init(void); +int __init numa_add_memblk(int nodeid, u64 start, u64 end); +void __init numa_set_distance(int from, int to, int distance); +void __init numa_free_distance(void); +void __init early_map_cpu_to_node(unsigned int cpu, int nid); +void numa_store_cpu_info(unsigned int cpu); +void numa_add_cpu(unsigned int cpu); +void numa_remove_cpu(unsigned int cpu); + +#else /* CONFIG_NUMA */ + +static inline void numa_store_cpu_info(unsigned int cpu) { } +static inline void numa_add_cpu(unsigned int cpu) { } +static inline void numa_remove_cpu(unsigned int cpu) { } +static inline void arch_numa_init(void) { } +static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { } + +#endif /* CONFIG_NUMA */ + +#endif /* __ASM_GENERIC_NUMA_H */ From patchwork Thu Nov 19 00:38:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11916279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC4B2C5519F for ; Thu, 19 Nov 2020 00:40:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21C7422266 for ; Thu, 19 Nov 2020 00:40:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="M5Zf9jmF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Os2SZR9n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21C7422266 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qCrfGtziUMeNtaEkN4DnA1yse+LhulZHJjq1PN5vwIY=; b=M5Zf9jmFQ3wtGRO+Meeon3QoY Un9CVd2MrL7Y9jc5Pl0ziFvOib/PhG/ipAf1A9ucuCPZlMziTiORvzddSiznWBc4VYnbzaVyTxyw/ lHtJa+HQ2W//b2FDbl+BlJZhcgp/CTVO0SOQsU55xAaeIzwfjH+58fJr8CxFpYGhOeKDH+af+KYd9 eoOgx2ydO4ywZwrhIiplNdaRhqRFKqcDnpA10+vp6pe5iDA3UYzAotL53H9k21sprQEiUUlu+zDER przEtSGOdqodlYpq50nk3x0K7ykXP7ICMleCER9JfloKvizrOeVOT7J7SYHl/I3MF5ozz6IAV8LX6 uOFr0pdQA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyx-0006Kz-Ty; Thu, 19 Nov 2020 00:39:28 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyD-0006C3-5h; Thu, 19 Nov 2020 00:38:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1605746721; x=1637282721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GUaYqW4/OtPcVsQlEiV+NW6wzQDKURMHsfJSB6w7l4o=; b=Os2SZR9nd0Pn5bYdAjfet6bOWzy6X1GgmkI3QBmUscY7yhaoQOJIieM+ LNvWNz2boailVinuIVmMkqWLGVNxD3YeRBJehghS6yGWJVAGbYDucFB1O TtFe+xZ7BPa8fX3r1GFtwDTG6L7pMA/+yWgrhCCYTkwguEXPtw/pz+Vqv JwVFGsWe6/mjRN1lUwTYNtiHzOY6n3yNe5nmSGjrAXJe1zs8tWpziARXz kyb4f0jeJYSR56zrsjaK7me2zepqVKfqGESWTTwmwmphrdfOIWZxadRlz LQem8QIRAmgm+f5WhNfMhzI/l3CQJgMWS5DK7yyi/WfFj+wKudDXDAqaW g==; IronPort-SDR: 9mzOeaawHKZqdiB7dHpD1KDZ7Tfhm+6cdlJRlSXqkkvuFXjhEh0JiaqvcLhBY77r0lq53CvRO4 ZPrHMC94BteP5j/ywEvgO7mH095tjo4H9RxaBlxcqy1+xlrNVGG8463OKmEzmsA4MAvFXinnBQ O0Sv+aZV/m86J4jxrJq7QY7id/7DWT/fvmlDd7g+4TARyJs1rfTTr0FupnAlgnKIRJ3wEDOdqj 6GJ2bmRKE1le9N4xu0S4VYZvx0ddAB+/YJUTlXRgS2mvi5jn8wLX41U9erKxJRG0EsGopoSMvY //E= X-IronPort-AV: E=Sophos;i="5.77,488,1596470400"; d="scan'208";a="256529107" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Nov 2020 08:45:17 +0800 IronPort-SDR: ayWovQHwJu8IztPB9J42RcGhliGTyI5jWjaR4cp0Dvkb2VxNEtuAS5LSE1fkPzptWiE8n2xofU uNHqshxmT7c4AlC6ZMuA89ef7fZ0qt6hkCrdRVC7YdR2/0Ajt8OEzE5spe9ShyJDlrSLOs9/Al op6o9AiOSJ0EeyXg3na/e4tuzUkWVMXQV+f0lVNsXuQ3/YxxR1zNAyMlVRe9jmJPtGBRWymJ3h kIwSOQrCZ2P58mt5SGOmrA0kW+BwZujuhfcKVPpI/P6FM+kBcLGCniCqTxZ5VVTxIc9vJbV3C1 Ei6elB81W2rQbru3CnbnDuvM Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 16:23:09 -0800 IronPort-SDR: risX5pD68f3hhs/NiXWXWp0naexRBIux6tSPhzOA2lH0DH2WM0DPaKLZK30a23KsaTvngg71k5 fTaNcLohcL1OBZTYVjGe2QnRMPXwersQduanJYS90weebYhgTxMGU3xNPIfvUorMe0YXSXjo5n pt+0LjUgmE8QJOghQUZYDxJgvmtZueuy1PQHw4ls3AZFY4SHgq3a1UfWuMVV3k1pe5IP+e7cWU Rejbda9CEO640ZXnkFk6A4iM6ivFLbS6Cn/rKkdns5zS8SnzHhf5GCEVKKNjGjHTDHzpt+Rdvf /5A= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.61.71]) by uls-op-cesaip02.wdc.com with ESMTP; 18 Nov 2020 16:38:37 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v5 3/5] riscv: Separate memory init from paging init Date: Wed, 18 Nov 2020 16:38:27 -0800 Message-Id: <20201119003829.1282810-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201119003829.1282810-1-atish.patra@wdc.com> References: <20201119003829.1282810-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_193841_409107_5CC75DCA X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Rafael J. Wysocki" , Catalin Marinas , Palmer Dabbelt , Atish Patra , linux-riscv@lists.infradead.org, Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Zhengyuan Liu , Baoquan He , Anup Patel , Daniel Lezcano , Steven Price , Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Palmer Dabbelt , Jonathan Cameron , Andrew Morton , Mike Rapoport Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, we perform some memory init functions in paging init. But, that will be an issue for NUMA support where DT needs to be flattened before numa initialization and memblock_present can only be called after numa initialization. Move memory initialization related functions to a separate function. Signed-off-by: Atish Patra Reviewed-by: Greentime Hu Reviewed-by: Anup Patel Reviewed-by: Palmer Dabbelt --- arch/riscv/include/asm/pgtable.h | 1 + arch/riscv/kernel/setup.c | 1 + arch/riscv/mm/init.c | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 183f1f4b2ae6..a0f8a86236e8 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -471,6 +471,7 @@ extern void *dtb_early_va; extern uintptr_t dtb_early_pa; void setup_bootmem(void); void paging_init(void); +void misc_mem_init(void); #define FIRST_USER_ADDRESS 0 diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index c424cc6dd833..eb1cbdc29ea7 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -88,6 +88,7 @@ void __init setup_arch(char **cmdline_p) else pr_err("No DTB found in kernel mappings\n"); #endif + misc_mem_init(); #ifdef CONFIG_SWIOTLB swiotlb_init(1); diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 8e577f14f120..826e7de73f45 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -664,8 +664,12 @@ static void __init resource_init(void) void __init paging_init(void) { setup_vm_final(); - sparse_init(); setup_zero_page(); +} + +void __init misc_mem_init(void) +{ + sparse_init(); zone_sizes_init(); resource_init(); } From patchwork Thu Nov 19 00:38:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11916271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2347DC5519F for ; Thu, 19 Nov 2020 00:39:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A588F2467A for ; Thu, 19 Nov 2020 00:39:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tWmd/1Bj"; dkim=permerror (0-bit key) header.d=wdc.com header.i=@wdc.com header.b="auLqOSDG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A588F2467A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QmtyHQkUUnb4E5t+cljlJK8DpC9yrZNv9TK+DvhACEA=; b=tWmd/1BjJ7enChjDk6fbiq8Lh fwe0GkMzZXMb34xqNuXbWJqAGUNCjbYQlE4sesz2e+yJouX9SzytOZj0n9j63JTH1AR7tavoWEaIh 5NWaR/3cGkywoYoV4bs+6vkryvHBOq1/Vnc2pPd77YsGxqrElaUQxj3e4i4jWCS0Wrdd4fe+Epr9T xFMRy1FjBNfUPsdF5L/ln3+/pa/XLwOu4UjaNDksvU7s9t8i+cHjmyp+iFjQG+ocvrsT8v8B1aXU4 OYKgvqXc0Chgn4VGf9FshcYnhSPdEti+u7dWX+GD/+Img69J7Gtc67KIGJO5URJ2XWJHVKApsIgh/ 2x8VzgTig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyq-0006IZ-5f; Thu, 19 Nov 2020 00:39:20 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyD-0006CB-Ba; Thu, 19 Nov 2020 00:38:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1605746721; x=1637282721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tBpauZx+fMSCAhtcJtgaXTjyMk4K33HNxdPCRgo5eAU=; b=auLqOSDGDeUH/ZgE0RfihCrdK7paKWK2VYIGQb40iqFI9VGRXTKVIpqh p2hcdL5J8tvKTBaTkJYhHbBsT9pBjRqF822ozxB8EEIZSIwGzmAmERaY8 RqbgCv3WtD6iw8SUme9R3RY7dAMwTC6BI+g+14BSK6yZzWSLuU8DA/F30 X/h6cLnLHh7gTl+B8WLv5rhgBLqDzhNSoiS3Vo1vx9owNgdO8fi1v/ymc jeuYs/qC8MwZc5rih/OipKrml8bpYI6W8UAjoDoZ/lr5XRsJ/sQRq0PRk Qe4yPfBhCM7jnxjfkDWjcaC/Kk2z3Oe0z3PNTqFdB0ge1c5yYczenzgvv w==; IronPort-SDR: 3bGiiIWpW+OSLnKfbEEqObRNwGP8yerBMu5XBuFBDr3Fw4OQK0yR1VMxEvTzLHUKj1+F3KZKYb nW1fXHvzbaf0BQs6KHmPDuGb/oCgLr7HVCPGC7ih47HA2/JZa6jwdPVpm6X16pJp03YwDdnltL FUacKfUIoCmhUh7+nGxfcorAUr5icVgOAtbtG7zS+lmngK/Y0+iBs9XPLSzAzXvSjAq7KOMNTB 53hpy176M34B80cWC27lWLCGuXb83AnKvLbrqYBYEcSIgkymws7qPe4GRpoIUzVhl3ahoCl8MZ dNw= X-IronPort-AV: E=Sophos;i="5.77,488,1596470400"; d="scan'208";a="256529115" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Nov 2020 08:45:18 +0800 IronPort-SDR: LSKsZZ7Eg+8HT398Ev5KTgXC5NXTXksDh6hXzQpih7aL+5IqKBJqy0tN+oNSi2Vku4v2usK3aX FafrjtUQtX0C1Syiyf2dZxBPvfOsK3HGCne294B5bbnAHRaZNa39G3Q2BBNTahA1vOBz9f97Rf HlEaO68yeEIuOvD9C+FJl8++Kp96zW61KDnN7tl0tqpKSEwgiKgRd/hT3vxM6hGodUSctmS9Hk Au3fPe3s5m1ZNXFoUzIdZ0Pp/JJfkmVrvlDTW26ePEsrBFr3FJcFfK6Iz+7kxVvGBJJE2kZKvQ ZsFaKZPJJFTPhMzNY3KB6pE7 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 16:23:10 -0800 IronPort-SDR: WCaCsrsQeD76vs6BFx7SRimVV5INxI7DErIY0dh+zHL6r7f7mSDPhUNFrE4WqDFTIutVZMMunu wqhTxTrVS1A9vDQVtpsuWjd/gi0VH2iIABey0qs6WV6Xv3BZacKVArX7YI67nLhsntgDW28ipN Xn4BjRUZbX1axB9UG2WOz118O/X055REKNgOJ3MBAMk7DUnaK/LdNxI5NBZ3Gzj6oL4LbP1s1d VwgDTQ2No147z99s/TxQB3G3eNk7wdpCEnmu3aYGSBmgCYjZBFQ4NDa3q2K0v3fseBt1l/zGNy 6x0= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.61.71]) by uls-op-cesaip02.wdc.com with ESMTP; 18 Nov 2020 16:38:37 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v5 4/5] riscv: Add support pte_protnone and pmd_protnone if CONFIG_NUMA_BALANCING Date: Wed, 18 Nov 2020 16:38:28 -0800 Message-Id: <20201119003829.1282810-5-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201119003829.1282810-1-atish.patra@wdc.com> References: <20201119003829.1282810-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_193841_626553_EFFBD5CE X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Rafael J. Wysocki" , Catalin Marinas , Palmer Dabbelt , Atish Patra , linux-riscv@lists.infradead.org, Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Zhengyuan Liu , Baoquan He , Anup Patel , Daniel Lezcano , Steven Price , Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Palmer Dabbelt , Jonathan Cameron , Andrew Morton , Mike Rapoport Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Greentime Hu These two functions are used to distinguish between PROT_NONENUMA protections and hinting fault protections. Signed-off-by: Greentime Hu Reviewed-by: Anup Patel Reviewed-by: Palmer Dabbelt --- arch/riscv/include/asm/pgtable.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index a0f8a86236e8..64aba4f7a0ed 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -187,6 +187,11 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) return (unsigned long)pfn_to_virt(pmd_val(pmd) >> _PAGE_PFN_SHIFT); } +static inline pte_t pmd_pte(pmd_t pmd) +{ + return __pte(pmd_val(pmd)); +} + /* Yields the page frame number (PFN) of a page table entry */ static inline unsigned long pte_pfn(pte_t pte) { @@ -290,6 +295,21 @@ static inline pte_t pte_mkhuge(pte_t pte) return pte; } +#ifdef CONFIG_NUMA_BALANCING +/* + * See the comment in include/asm-generic/pgtable.h + */ +static inline int pte_protnone(pte_t pte) +{ + return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)) == _PAGE_PROT_NONE; +} + +static inline int pmd_protnone(pmd_t pmd) +{ + return pte_protnone(pmd_pte(pmd)); +} +#endif + /* Modify page protection bits */ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { From patchwork Thu Nov 19 00:38:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11916273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F094DC5519F for ; Thu, 19 Nov 2020 00:40:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5783B238E6 for ; Thu, 19 Nov 2020 00:40:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r2X2nG7N"; dkim=permerror (0-bit key) header.d=wdc.com header.i=@wdc.com header.b="WS1k0+Cq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5783B238E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CTgjYu0hdsTDNqE7RMRft45ww1Q/TYrMio6JHUVoNx4=; b=r2X2nG7N4h+EB8gzIqRb/shnz PVpvQ6+cIEYclJVq//qhj6X3nayRT6AwpMJAikrBi+t5pNgRpfjQErQn9XUt3MrXrg1Xf+iNBxjGd nZKFvIW9H5xoethiU2QKEhSsOw9PzYByagzqM9DiB6mgHaDVmgasiiHBaKUwcSLeUANkWWsECJgfl W8HD7U9EI1l/UDMpnr+bzX3pmbYiKpCE8BwU5cQcLEykwyT5ILIgFF2C1/uPUf78uVRoCha9GZDr4 K6/of6basrJwpvfwafFuAWZ+gDJOj9SB/wyJLlhzv0T1EsSDgPFeIy0SzbJZYp+Cj1xs7gq2XN3fS CqmKPw11A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXz8-0006Og-NF; Thu, 19 Nov 2020 00:39:38 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfXyI-0006CJ-7g; Thu, 19 Nov 2020 00:38:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1605746728; x=1637282728; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Qp8TCYaXaopaPTPsiJ0rVCynZ7BwUesX2w2H35SSgiU=; b=WS1k0+CqxSqEgUg0q9cCnNB9FPXgKsiV1jI+TqzcnucW2Wzbqp9S9Xdc RuULUm0EBYEr2cj692jkT3KibDXIwZGP908sCb90PEisDi+OSuPSHg5u1 Kk0OiKj/nu0k/sG8ExPaTcEF7mVjtJ6CRr+MHk0OQ3cbeBakG5roBphW9 kKgtzkKqDBydylSjTwzkDUCd8+vMWN5Mn2g7k9NvIATOJs+z8F7y5Pdc+ srdsXigcHD8Wcwv+QN9l11fpJcFgf3bbHfM2gbVBFj5XLPbgpMcCefx8k UVWA68x2t9UH708Jg8rRC2DvktQ0mJmqokxTnqbOuTk8gKYoLWXHyZy1s A==; IronPort-SDR: kk9thpO9hbp795itJuwsgKqX45PjupRuhL7GKuc37ydf4SX3ab4ZiT/iWLneN4yd8Qdac/1s/c nZQ6OCW3P5XH/ZeEvXQON+9x0fZzE0B3GBDDY4QvLGmLUzTkIcLfCikDoguG7Wdx1oa4qeQX4m BXdsAXxiRayKehlm8O780cUH6xXsJmiFnjdmNLvxe6SPdmUB0i7bCXU5C2xx4GP0bA5mxRjNXs SpLMlT8cg2R0U4vlLleRjtmm7K4zRHO0hFOuKwXyZ0MFDCEFWx0Plszu2knDlD32UwyWoJIqGU vK8= X-IronPort-AV: E=Sophos;i="5.77,488,1596470400"; d="scan'208";a="256529119" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Nov 2020 08:45:19 +0800 IronPort-SDR: k3hXGbQdxzAGgp6/PkGmJB8NioVt+5+PLEDNYCfe5DYH50RPTQyfZPwKD32aT7y18dfx2+uJN5 sJpVG20TIFITf9mp0hNfCVPPP0bpA0L3MeoYj5Ux6pSZtFNTQZSSdRDIzwkiMKvt3Z4upu83hL e4q5V4GhzfCST39B1Me8t3HoQc9FORzs1IjyKuhVFPQOtU0hMzd48VnvKlqbmjoc4pzbwOne/T 4wjGnayPW0pRwbkjh+ro6xXo+br7/YzEDbZe+ebqw5UzjQmQmRKgS3wDLyoC4WDLEPoVUWyM5O vpyKzmdY1IxuhmMkv3Oh37XI Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 16:23:11 -0800 IronPort-SDR: C+KfU0ZzZTBZrm2AmqLQM5wYz0+PjH6Uyaoyh3h1sRHUnq5S+CrHLYeP+KZOv0FTAYZlFbS6Gx XUPxV2+47BTMh/xIE32rhmMAT6tNBjdOtULktkr8UZiq2X6ySqp4N0eJrFTOHe6j7WDx8qxJ2T lgeBbnGhxi4WUqaTZUHQJrFbPkzWvc3N+hcJYk9o09uzisYvpeMUK79RiCXKSikb+z7E87EaaR jq3b36br6G8nQx02W1jb5qN0xBMtJ9dZZ10v83qdsHUbiidSDkqKEv5V2F4LaHK1SRhJAYqNdG +PA= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.61.71]) by uls-op-cesaip02.wdc.com with ESMTP; 18 Nov 2020 16:38:38 -0800 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v5 5/5] riscv: Add numa support for riscv64 platform Date: Wed, 18 Nov 2020 16:38:29 -0800 Message-Id: <20201119003829.1282810-6-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201119003829.1282810-1-atish.patra@wdc.com> References: <20201119003829.1282810-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_193846_591570_CF28AFCD X-CRM114-Status: GOOD ( 29.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Rafael J. Wysocki" , Catalin Marinas , Palmer Dabbelt , Atish Patra , linux-riscv@lists.infradead.org, Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Zhengyuan Liu , Baoquan He , Anup Patel , Daniel Lezcano , Steven Price , Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Palmer Dabbelt , Jonathan Cameron , Andrew Morton , Mike Rapoport Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic numa implementation to add NUMA support for RISC-V. This is based on Greentime's patch[1] but modified to use generic NUMA implementation and few more fixes. [1] https://lkml.org/lkml/2020/1/10/233 Co-developed-by: Greentime Hu Signed-off-by: Greentime Hu Signed-off-by: Atish Patra Reviewed-by: Anup Patel Reviewed-by: Palmer Dabbelt --- arch/riscv/Kconfig | 31 ++++++++++++++++++++++++++++++- arch/riscv/include/asm/mmzone.h | 13 +++++++++++++ arch/riscv/include/asm/numa.h | 8 ++++++++ arch/riscv/include/asm/pci.h | 14 ++++++++++++++ arch/riscv/kernel/setup.c | 10 ++++++++-- arch/riscv/kernel/smpboot.c | 12 +++++++++++- arch/riscv/mm/init.c | 4 +++- 7 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 arch/riscv/include/asm/mmzone.h create mode 100644 arch/riscv/include/asm/numa.h diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 44377fd7860e..5414fe747f64 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -140,7 +140,7 @@ config PAGE_OFFSET default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB config ARCH_FLATMEM_ENABLE - def_bool y + def_bool !NUMA config ARCH_SPARSEMEM_ENABLE def_bool y @@ -298,6 +298,35 @@ config TUNE_GENERIC endchoice +# Common NUMA Features +config NUMA + bool "NUMA Memory Allocation and Scheduler Support" + select GENERIC_ARCH_NUMA + select OF_NUMA + select ARCH_SUPPORTS_NUMA_BALANCING + help + Enable NUMA (Non-Uniform Memory Access) support. + + The kernel will try to allocate memory used by a CPU on the + local memory of the CPU and add some more NUMA awareness to the kernel. + +config NODES_SHIFT + int "Maximum NUMA Nodes (as a power of 2)" + range 1 10 + default "2" + depends on NEED_MULTIPLE_NODES + help + Specify the maximum number of NUMA Nodes available on the target + system. Increases memory reserved to accommodate various tables. + +config USE_PERCPU_NUMA_NODE_ID + def_bool y + depends on NUMA + +config NEED_PER_CPU_EMBED_FIRST_CHUNK + def_bool y + depends on NUMA + config RISCV_ISA_C bool "Emit compressed instructions when building Linux" default y diff --git a/arch/riscv/include/asm/mmzone.h b/arch/riscv/include/asm/mmzone.h new file mode 100644 index 000000000000..fa17e01d9ab2 --- /dev/null +++ b/arch/riscv/include/asm/mmzone.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MMZONE_H +#define __ASM_MMZONE_H + +#ifdef CONFIG_NUMA + +#include + +extern struct pglist_data *node_data[]; +#define NODE_DATA(nid) (node_data[(nid)]) + +#endif /* CONFIG_NUMA */ +#endif /* __ASM_MMZONE_H */ diff --git a/arch/riscv/include/asm/numa.h b/arch/riscv/include/asm/numa.h new file mode 100644 index 000000000000..8c8cf4297cc3 --- /dev/null +++ b/arch/riscv/include/asm/numa.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_NUMA_H +#define __ASM_NUMA_H + +#include +#include + +#endif /* __ASM_NUMA_H */ diff --git a/arch/riscv/include/asm/pci.h b/arch/riscv/include/asm/pci.h index 1c473a1bd986..658e112c3ce7 100644 --- a/arch/riscv/include/asm/pci.h +++ b/arch/riscv/include/asm/pci.h @@ -32,6 +32,20 @@ static inline int pci_proc_domain(struct pci_bus *bus) /* always show the domain in /proc */ return 1; } + +#ifdef CONFIG_NUMA + +static inline int pcibus_to_node(struct pci_bus *bus) +{ + return dev_to_node(&bus->dev); +} +#ifndef cpumask_of_pcibus +#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ + cpu_all_mask : \ + cpumask_of_node(pcibus_to_node(bus))) +#endif +#endif /* CONFIG_NUMA */ + #endif /* CONFIG_PCI */ #endif /* _ASM_RISCV_PCI_H */ diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index eb1cbdc29ea7..26712745c5df 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -111,13 +111,19 @@ void __init setup_arch(char **cmdline_p) static int __init topology_init(void) { - int i; + int i, ret; + + for_each_online_node(i) + register_one_node(i); for_each_possible_cpu(i) { struct cpu *cpu = &per_cpu(cpu_devices, i); cpu->hotpluggable = cpu_has_hotplug(i); - register_cpu(cpu, i); + ret = register_cpu(cpu, i); + if (unlikely(ret)) + pr_warn("Warning: %s: register_cpu %d failed (%d)\n", + __func__, i, ret); } return 0; diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 96167d55ed98..5e276c25646f 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -45,13 +46,18 @@ void __init smp_prepare_cpus(unsigned int max_cpus) { int cpuid; int ret; + unsigned int curr_cpuid; + + curr_cpuid = smp_processor_id(); + numa_store_cpu_info(curr_cpuid); + numa_add_cpu(curr_cpuid); /* This covers non-smp usecase mandated by "nosmp" option */ if (max_cpus == 0) return; for_each_possible_cpu(cpuid) { - if (cpuid == smp_processor_id()) + if (cpuid == curr_cpuid) continue; if (cpu_ops[cpuid]->cpu_prepare) { ret = cpu_ops[cpuid]->cpu_prepare(cpuid); @@ -59,6 +65,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) continue; } set_cpu_present(cpuid, true); + numa_store_cpu_info(cpuid); } } @@ -79,6 +86,7 @@ void __init setup_smp(void) if (hart == cpuid_to_hartid_map(0)) { BUG_ON(found_boot_cpu); found_boot_cpu = 1; + early_map_cpu_to_node(0, of_node_to_nid(dn)); continue; } if (cpuid >= NR_CPUS) { @@ -88,6 +96,7 @@ void __init setup_smp(void) } cpuid_to_hartid_map(cpuid) = hart; + early_map_cpu_to_node(cpuid, of_node_to_nid(dn)); cpuid++; } @@ -153,6 +162,7 @@ asmlinkage __visible void smp_callin(void) current->active_mm = mm; notify_cpu_starting(curr_cpuid); + numa_add_cpu(curr_cpuid); update_siblings_masks(curr_cpuid); set_cpu_online(curr_cpuid, 1); diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 826e7de73f45..e1f1b149dfba 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "../kernel/head.h" @@ -195,7 +196,6 @@ void __init setup_bootmem(void) early_init_fdt_scan_reserved_mem(); memblock_allow_resize(); - memblock_dump_all(); } #ifdef CONFIG_MMU @@ -669,9 +669,11 @@ void __init paging_init(void) void __init misc_mem_init(void) { + arch_numa_init(); sparse_init(); zone_sizes_init(); resource_init(); + memblock_dump_all(); } #ifdef CONFIG_SPARSEMEM_VMEMMAP