Skip to content

Commit

Permalink
cpu/numa: fix failure when hot-remove cpu
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jongwu committed Jun 30, 2022
1 parent 744b6fb commit 13c5067
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions arch/arm64/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number);
*/
extern u64 __cpu_logical_map[NR_CPUS];
extern u64 cpu_logical_map(unsigned int cpu);
extern u64 get_acpicpu_numa_node(unsigned int cpu);
extern int set_acpicpu_numa_node(unsigned int cpu, unsigned int node);

static inline void set_cpu_logical_map(unsigned int cpu, u64 hwid)
{
Expand Down
14 changes: 14 additions & 0 deletions arch/arm64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,20 @@ static int __init reserve_memblock_reserved_regions(void)
}
arch_initcall(reserve_memblock_reserved_regions);

u64 __acpicpu_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };

u64 get_acpicpu_numa_node(unsigned int cpu)
{
return __acpicpu_node_map[cpu];
}

int set_acpicpu_numa_node(unsigned int cpu, unsigned int node)
{
__acpicpu_node_map[cpu] = node;

return 0;
}

u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };

u64 cpu_logical_map(unsigned int cpu)
Expand Down
6 changes: 4 additions & 2 deletions arch/arm64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,18 @@ static int set_numa_node_for_cpu(acpi_handle handle, int cpu)

/* will evaluate _PXM */
node_id = acpi_get_node(handle);
if (node_id != NUMA_NO_NODE)
if (node_id != NUMA_NO_NODE) {
set_acpicpu_numa_node(cpu, node_id);
set_cpu_numa_node(cpu, node_id);
}
#endif
return 0;
}

static void unset_numa_node_for_cpu(int cpu)
{
#ifdef CONFIG_ACPI_NUMA
set_cpu_numa_node(cpu, NUMA_NO_NODE);
set_acpicpu_numa_node(cpu, NUMA_NO_NODE);
#endif
}

Expand Down

0 comments on commit 13c5067

Please sign in to comment.