Skip to content

Commit dc29f27

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. Singed-off-by: Jianyong Wu <[email protected]>
1 parent d911b9b commit dc29f27

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
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-1
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,18 @@ static int set_numa_node_for_cpu(acpi_handle handle, int cpu)
559559
/* will evaluate _PXM */
560560
node_id = acpi_get_node(handle);
561561
if (node_id != NUMA_NO_NODE)
562+
{
563+
set_acpicpu_numa_node(cpu, node_id);
562564
set_cpu_numa_node(cpu, node_id);
565+
}
563566
#endif
564567
return 0;
565568
}
566569

567570
static void unset_numa_node_for_cpu(int cpu)
568571
{
569572
#ifdef CONFIG_ACPI_NUMA
570-
set_cpu_numa_node(cpu, NUMA_NO_NODE);
573+
set_acpicpu_numa_node(cpu, NUMA_NO_NODE);
571574
#endif
572575
}
573576

0 commit comments

Comments
 (0)