Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2956633pxb; Mon, 19 Apr 2021 19:17:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFftgIYQbl8ptZM5z6QNP2x3Gah733W3OTiLDfP4uAIxEoWxKAmGhtdTXyjWFGitKe2YZg X-Received: by 2002:a17:90b:2242:: with SMTP id hk2mr2366407pjb.4.1618885062482; Mon, 19 Apr 2021 19:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618885062; cv=none; d=google.com; s=arc-20160816; b=PS1j8Q4qpX0f3u+Vw1eppr7jmBCafHmA6o/qK2LHbdfulCosmSk9M3ZUT5T+YB5ye2 SJSgNGH0nyiskdHYRJb1HI+o+i8zFpDf1bLDk0YklEaP5yL6CNNWLCRc8KTxNwoyxGfK 5vTjtTQzaeWGc6+dqGbuNjJHGkPKGkDhi5iANcq2JaXW9rsqgkMQumngYMjzEKluSWan UBIuIMyYiwSrQIMvse8EEjmMkXmNsU9loR5EbWaU2z85BXJv6DAzD+Jk22C+fCcU+TyV R9xNp1Jkq6+IpVv7VRC2PoJVidGGFqm5kXhnDy1GacJHx2581GuWI/je7Gru7vZ0HjmH /FYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=91yWeXIgKcz9hf5Zo0V1XXKevn6FAlqnCdkutQ+Yc6U=; b=cobvxSvNmr775zwkV95tGJCNzqVFeAD6mxkT/QHFxDuI9tXBEzKiLoinp5GXyG5uaJ +14fPp20nLK0lKiebhW8+M43HCMoh3drXLVXIkR0Dc2BuX3Qi6GykB+ZZksD/ZQmTM7S AMzKJuhaommm3cjVKBOLMb3372f5K+exFhM0N4d+grCo0wkdWTFjs6c0E1BEj52iSJGi bW9ZmLM/n2wWfFyQ+YL1CoI5Gc4zuDEnIC1om7duVyze+7KWX1Qj5KvYJvGyh7heraUU b+eLKJgLwPExbS9fyqBTQKPyYHNbmjxUk80kqEVfdF1MfFH/tpmpK2o99a6rOw7VjAPO ULfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si21807186pgo.596.2021.04.19.19.17.19; Mon, 19 Apr 2021 19:17:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233308AbhDTCRB (ORCPT + 99 others); Mon, 19 Apr 2021 22:17:01 -0400 Received: from mail.loongson.cn ([114.242.206.163]:42222 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229534AbhDTCRA (ORCPT ); Mon, 19 Apr 2021 22:17:00 -0400 Received: from [10.130.0.193] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9CxU+B4OX5ga8oKAA--.18176S3; Tue, 20 Apr 2021 10:16:26 +0800 (CST) Subject: Re: [PATCH] MIPS: Fix cmdline "mem=" parameter parsing To: Jiaxun Yang , Thomas Bogendoerfer References: <1618829425-11873-1-git-send-email-tangyouling@loongson.cn> <5d4d31aa-7fe5-bf8d-1d77-a1605f0c2793@flygoat.com> Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jinyang He From: Youling Tang Message-ID: <3e8be714-6017-b0c7-9c71-7464d9b2b793@loongson.cn> Date: Tue, 20 Apr 2021 10:16:24 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <5d4d31aa-7fe5-bf8d-1d77-a1605f0c2793@flygoat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9CxU+B4OX5ga8oKAA--.18176S3 X-Coremail-Antispam: 1UD129KBjvJXoW7uFWkur1UXFy7ArW3ur15urg_yoW8Cr4xpw 4UCa4Fka1qgr9Fg3W0y395uw1rJas5GFWxJF47Zwn5A3WqqF1xJF1FqF15uFyIvrW7K3WI qa4j9ryUuan7ZFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvG14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F 4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCYjI0SjxkI62AI1cAE 67vIY487MxkIecxEwVAFwVW8JwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJV W8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF 1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6x IIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAI cVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa 73UjIFyTuYvjfUnhFxUUUUU X-CM-SenderInfo: 5wdqw5prxox03j6o00pqjv00gofq/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Jiaxun On 04/20/2021 09:05 AM, Jiaxun Yang wrote: > > 在 2021/4/19 18:50, Youling Tang 写道: >> 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 >> --- >> 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)); > > pa_to_nid is not available for all platforms. > Thanks for your correction. pa_to_nid() only has actual definitions in mach-ip27 and mach-loongson64 (only for NUMA platform). In arch/mips/include/asm/mmzone.h: #ifndef pa_to_nid #define pa_to_nid(addr) 0 #endif So only need #include to solve the "error: implicit declaration of function'pa_to_nid'" compilation error. Thanks, Youling > > Thanks. > > - Jiaxun > >> return 0; >> }