From patchwork Mon Apr 19 10:50:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youling Tang X-Patchwork-Id: 12211405 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, 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 5E359C433B4 for ; Mon, 19 Apr 2021 10:51:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E01261077 for ; Mon, 19 Apr 2021 10:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231387AbhDSKvl (ORCPT ); Mon, 19 Apr 2021 06:51:41 -0400 Received: from mail.loongson.cn ([114.242.206.163]:60926 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230013AbhDSKvl (ORCPT ); Mon, 19 Apr 2021 06:51:41 -0400 Received: from bogon.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx7+6CYH1gAlwKAA--.1828S2; Mon, 19 Apr 2021 18:50:42 +0800 (CST) From: Youling Tang To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jinyang He Subject: [PATCH] MIPS: Fix cmdline "mem=" parameter parsing Date: Mon, 19 Apr 2021 18:50:25 +0800 Message-Id: <1618829425-11873-1-git-send-email-tangyouling@loongson.cn> X-Mailer: git-send-email 2.1.0 MIME-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UUU= X-CM-SenderInfo: 5wdqw5prxox03j6o00pqjv00gofq/ Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org This problem may only occur on NUMA platforms. When machine start with the "mem=" parameter on Loongson64, it cannot boot. When parsing the "mem=" parameter, first remove all RAM, and then add memory through memblock_add(), which causes the newly added memory to be located on MAX_NUMNODES. The solution is to add the current "mem=" parameter range to the memory area of the corresponding node, instead of adding all of it to the MAX_NUMNODES node area. Get the node number corresponding to the "mem=" parameter range through pa_to_nid(), and then add it to the corresponding node through memblock_add_node(). Signed-off-by: Jinyang He Signed-off-by: Youling Tang Reported-by: kernel test robot --- arch/mips/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 279be01..b86e241 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -359,7 +359,7 @@ static int __init early_parse_mem(char *p) if (*p == '@') start = memparse(p + 1, &p); - memblock_add(start, size); + memblock_add_node(start, size, pa_to_nid(start)); return 0; }