Re: [PATCH] MIPS: Loongson64: Give chance to build under !CONFIG_NUMA and !CONFIG_SMP

From: Tiezhu Yang
Date: Tue Dec 29 2020 - 20:04:40 EST


On 12/30/2020 12:39 AM, Thomas Bogendoerfer wrote:
On Wed, Dec 16, 2020 at 10:44:23AM +0800, Tiezhu Yang wrote:
I have tested the following three configs on the Loongson platform:
(1) !NUMA and !SMP,
(2) !NUMA and SMP,
(3) NUMA and SMP,
everything is all right.

But there exists the following build error under NUMA and !SMP:

CC arch/mips/kernel/asm-offsets.s
In file included from ./include/linux/gfp.h:9:0,
from ./include/linux/xarray.h:14,
from ./include/linux/radix-tree.h:19,
from ./include/linux/fs.h:15,
from ./include/linux/compat.h:17,
from arch/mips/kernel/asm-offsets.c:12:
./include/linux/topology.h: In function ‘numa_node_id’:
./include/linux/topology.h:119:2: error: implicit declaration of function
‘cpu_logical_map’ [-Werror=implicit-function-declaration]
return cpu_to_node(raw_smp_processor_id());
^
cc1: some warnings being treated as errors
scripts/Makefile.build:117: recipe for target
'arch/mips/kernel/asm-offsets.s' failed
make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1
arch/mips/Makefile:396: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2

I find a patch to fix this kind of build errors [1], but it seems
meaningless.

According to the NUMA and SMP description in arch/mips/Kconfig,
we will use only one CPU of a multiprocessor machine if !SMP,
on single node systems leave NUMA disabled.

So I think there is no need to use NUMA if !SMP, and also we should
make NUMA depend on SMP to avoid build errors.
ok, but compiling IP27 with your patch gives

WARNING: unmet direct dependencies detected for NUMA
Depends on [n]: SYS_SUPPORTS_NUMA [=y] && SMP [=n]
Selected by [y]:
- SGI_IP27 [=y] && <choice>

WARNING: unmet direct dependencies detected for NUMA
Depends on [n]: SYS_SUPPORTS_NUMA [=y] && SMP [=n]
Selected by [y]:
- SGI_IP27 [=y] && <choice>

WARNING: unmet direct dependencies detected for NUMA
Depends on [n]: SYS_SUPPORTS_NUMA [=y] && SMP [=n]
Selected by [y]:
- SGI_IP27 [=y] && <choice>

If I use "select SMP" instead both ip27 and loongson64 compile.

If you are ok with this change, I'll change it while appling your
patch.

No problem, looks good to me, thank you very much.

Thanks,
Tiezhu

Thomas.