Skip to content

Commit 13c5067

Browse files
committed
cpu/numa: fix failure when hot-remove cpu
When hot-remove cpu, the map from cpu to numa will set to NUMA_NO_NODE which will lead to failure as the map is used by others. Thus we need a specific map to descrip the unpluged cpu. Here we introduce a new map to descrip the unpluged cpu map. Signed-off-by: Jianyong Wu <[email protected]>
1 parent 744b6fb commit 13c5067

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

arch/arm64/include/asm/smp.h

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number);
4747
*/
4848
extern u64 __cpu_logical_map[NR_CPUS];
4949
extern u64 cpu_logical_map(unsigned int cpu);
50+
extern u64 get_acpicpu_numa_node(unsigned int cpu);
51+
extern int set_acpicpu_numa_node(unsigned int cpu, unsigned int node);
5052

5153
static inline void set_cpu_logical_map(unsigned int cpu, u64 hwid)
5254
{

arch/arm64/kernel/setup.c

+14
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,20 @@ static int __init reserve_memblock_reserved_regions(void)
284284
}
285285
arch_initcall(reserve_memblock_reserved_regions);
286286

287+
u64 __acpicpu_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };
288+
289+
u64 get_acpicpu_numa_node(unsigned int cpu)
290+
{
291+
return __acpicpu_node_map[cpu];
292+
}
293+
294+
int set_acpicpu_numa_node(unsigned int cpu, unsigned int node)
295+
{
296+
__acpicpu_node_map[cpu] = node;
297+
298+
return 0;
299+
}
300+
287301
u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
288302

289303
u64 cpu_logical_map(unsigned int cpu)

arch/arm64/kernel/smp.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -556,16 +556,18 @@ static int set_numa_node_for_cpu(acpi_handle handle, int cpu)
556556

557557
/* will evaluate _PXM */
558558
node_id = acpi_get_node(handle);
559-
if (node_id != NUMA_NO_NODE)
559+
if (node_id != NUMA_NO_NODE) {
560+
set_acpicpu_numa_node(cpu, node_id);
560561
set_cpu_numa_node(cpu, node_id);
562+
}
561563
#endif
562564
return 0;
563565
}
564566

565567
static void unset_numa_node_for_cpu(int cpu)
566568
{
567569
#ifdef CONFIG_ACPI_NUMA
568-
set_cpu_numa_node(cpu, NUMA_NO_NODE);
570+
set_acpicpu_numa_node(cpu, NUMA_NO_NODE);
569571
#endif
570572
}
571573

0 commit comments

Comments
 (0)