Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 3de9c42

Browse files
FlyGoatchenhuacai
authored andcommitted
LoongArch: Add all CPUs enabled by fdt to NUMA node 0
NUMA enabled kernel on FDT based machine fails to boot because CPUs are all in NUMA_NO_NODE and mm subsystem won't accept that. Fix by adding them to default NUMA node at FDT parsing phase and move numa_add_cpu(0) to a later point. Cc: stable@vger.kernel.org Fixes: 88d4d95 ("LoongArch: Add FDT booting support from efi system table") Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent b56f67a commit 3de9c42

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

arch/loongarch/include/asm/numa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ extern int early_cpu_to_node(int cpu);
5656
static inline void early_numa_add_cpu(int cpuid, s16 node) { }
5757
static inline void numa_add_cpu(unsigned int cpu) { }
5858
static inline void numa_remove_cpu(unsigned int cpu) { }
59+
static inline void set_cpuid_to_node(int cpuid, s16 node) { }
5960

6061
static inline int early_cpu_to_node(int cpu)
6162
{

arch/loongarch/kernel/smp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ static void __init fdt_smp_setup(void)
273273

274274
if (cpuid == loongson_sysconf.boot_cpu_id) {
275275
cpu = 0;
276-
numa_add_cpu(cpu);
277276
} else {
278277
cpu = cpumask_next_zero(-1, cpu_present_mask);
279278
}
@@ -283,6 +282,9 @@ static void __init fdt_smp_setup(void)
283282
set_cpu_present(cpu, true);
284283
__cpu_number_map[cpuid] = cpu;
285284
__cpu_logical_map[cpu] = cpuid;
285+
286+
early_numa_add_cpu(cpu, 0);
287+
set_cpuid_to_node(cpuid, 0);
286288
}
287289

288290
loongson_sysconf.nr_cpus = num_processors;
@@ -468,6 +470,7 @@ void smp_prepare_boot_cpu(void)
468470
set_cpu_possible(0, true);
469471
set_cpu_online(0, true);
470472
set_my_cpu_offset(per_cpu_offset(0));
473+
numa_add_cpu(0);
471474

472475
rr_node = first_node(node_online_map);
473476
for_each_possible_cpu(cpu) {

0 commit comments

Comments
 (0)