All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Fix cmdline "mem=" parameter parsing
@ 2021-04-19 10:50 Youling Tang
  2021-04-19 15:43   ` kernel test robot
  2021-04-20  1:05 ` Jiaxun Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Youling Tang @ 2021-04-19 10:50 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Jinyang He

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 <hejinyang@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
 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;
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: Fix cmdline "mem=" parameter parsing
  2021-04-19 10:50 [PATCH] MIPS: Fix cmdline "mem=" parameter parsing Youling Tang
@ 2021-04-19 15:43   ` kernel test robot
  2021-04-20  1:05 ` Jiaxun Yang
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-04-19 15:43 UTC (permalink / raw)
  To: Youling Tang, Thomas Bogendoerfer
  Cc: kbuild-all, linux-mips, linux-kernel, Jinyang He

[-- Attachment #1: Type: text/plain, Size: 2723 bytes --]

Hi Youling,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.12-rc8 next-20210419]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Youling-Tang/MIPS-Fix-cmdline-mem-parameter-parsing/20210419-185311
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bf05bf16c76bb44ab5156223e1e58e26dfe30a88
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c9cec6a7cf36ea04b1d8aca273a27e92007085e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Youling-Tang/MIPS-Fix-cmdline-mem-parameter-parsing/20210419-185311
        git checkout c9cec6a7cf36ea04b1d8aca273a27e92007085e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/mips/kernel/setup.c: In function 'early_parse_mem':
>> arch/mips/kernel/setup.c:362:33: error: implicit declaration of function 'pa_to_nid'; did you mean 'page_to_nid'? [-Werror=implicit-function-declaration]
     362 |  memblock_add_node(start, size, pa_to_nid(start));
         |                                 ^~~~~~~~~
         |                                 page_to_nid
   cc1: some warnings being treated as errors


vim +362 arch/mips/kernel/setup.c

   342	
   343	static int __init early_parse_mem(char *p)
   344	{
   345		phys_addr_t start, size;
   346	
   347		/*
   348		 * If a user specifies memory size, we
   349		 * blow away any automatically generated
   350		 * size.
   351		 */
   352		if (usermem == 0) {
   353			usermem = 1;
   354			memblock_remove(memblock_start_of_DRAM(),
   355				memblock_end_of_DRAM() - memblock_start_of_DRAM());
   356		}
   357		start = 0;
   358		size = memparse(p, &p);
   359		if (*p == '@')
   360			start = memparse(p + 1, &p);
   361	
 > 362		memblock_add_node(start, size, pa_to_nid(start));
   363	
   364		return 0;
   365	}
   366	early_param("mem", early_parse_mem);
   367	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 70250 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: Fix cmdline "mem=" parameter parsing
@ 2021-04-19 15:43   ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-04-19 15:43 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2794 bytes --]

Hi Youling,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.12-rc8 next-20210419]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Youling-Tang/MIPS-Fix-cmdline-mem-parameter-parsing/20210419-185311
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bf05bf16c76bb44ab5156223e1e58e26dfe30a88
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c9cec6a7cf36ea04b1d8aca273a27e92007085e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Youling-Tang/MIPS-Fix-cmdline-mem-parameter-parsing/20210419-185311
        git checkout c9cec6a7cf36ea04b1d8aca273a27e92007085e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/mips/kernel/setup.c: In function 'early_parse_mem':
>> arch/mips/kernel/setup.c:362:33: error: implicit declaration of function 'pa_to_nid'; did you mean 'page_to_nid'? [-Werror=implicit-function-declaration]
     362 |  memblock_add_node(start, size, pa_to_nid(start));
         |                                 ^~~~~~~~~
         |                                 page_to_nid
   cc1: some warnings being treated as errors


vim +362 arch/mips/kernel/setup.c

   342	
   343	static int __init early_parse_mem(char *p)
   344	{
   345		phys_addr_t start, size;
   346	
   347		/*
   348		 * If a user specifies memory size, we
   349		 * blow away any automatically generated
   350		 * size.
   351		 */
   352		if (usermem == 0) {
   353			usermem = 1;
   354			memblock_remove(memblock_start_of_DRAM(),
   355				memblock_end_of_DRAM() - memblock_start_of_DRAM());
   356		}
   357		start = 0;
   358		size = memparse(p, &p);
   359		if (*p == '@')
   360			start = memparse(p + 1, &p);
   361	
 > 362		memblock_add_node(start, size, pa_to_nid(start));
   363	
   364		return 0;
   365	}
   366	early_param("mem", early_parse_mem);
   367	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 70250 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: Fix cmdline "mem=" parameter parsing
  2021-04-19 10:50 [PATCH] MIPS: Fix cmdline "mem=" parameter parsing Youling Tang
  2021-04-19 15:43   ` kernel test robot
@ 2021-04-20  1:05 ` Jiaxun Yang
  2021-04-20  2:16   ` Youling Tang
  1 sibling, 1 reply; 5+ messages in thread
From: Jiaxun Yang @ 2021-04-20  1:05 UTC (permalink / raw)
  To: Youling Tang, Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Jinyang He


在 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 <hejinyang@loongson.cn>
> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
> ---
>   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.

- Jiaxun

>   
>   	return 0;
>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: Fix cmdline "mem=" parameter parsing
  2021-04-20  1:05 ` Jiaxun Yang
@ 2021-04-20  2:16   ` Youling Tang
  0 siblings, 0 replies; 5+ messages in thread
From: Youling Tang @ 2021-04-20  2:16 UTC (permalink / raw)
  To: Jiaxun Yang, Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel, Jinyang He

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 <hejinyang@loongson.cn>
>> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
>> ---
>>   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 <asm/mmzone.h> to solve the "error: implicit 
declaration
of function'pa_to_nid'" compilation error.

Thanks,
Youling
>
> Thanks.
>
> - Jiaxun
>
>>         return 0;
>>   }


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-20  2:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 10:50 [PATCH] MIPS: Fix cmdline "mem=" parameter parsing Youling Tang
2021-04-19 15:43 ` kernel test robot
2021-04-19 15:43   ` kernel test robot
2021-04-20  1:05 ` Jiaxun Yang
2021-04-20  2:16   ` Youling Tang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.