Skip to contentSkip to conversation

powerpc/pseries: use slab context cpumask allocation in CPU hotplug init

PATCH Applied Nicholas Piggin 5 participants 5 messages Nov 5, 2021 – Dec 21, 2021 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/1 powerpc/pseries: use slab context cpumask allocation in CPU hotplug init

Slab is up at this point, using the bootmem allocator triggers a warning. Switch to using the regular cpumask allocator.

---

This only matters when CONFIG_CPUMASK_OFFNODE=y, which has not been possible before on powerpc.

Thanks,
Nick

 arch/powerpc/platforms/pseries/hotplug-cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +5 -4
index d646c22e94ab..78a70ba60d24 100644
@@ -1016,12 +1016,13 @@ static int __init pseries_cpu_hotplug_init(void)
 	/* Processors can be added/removed only on LPAR */
 	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		for_each_node(node) {
-			alloc_bootmem_cpumask_var(&node_recorded_ids_map[node]);
+			if (!alloc_cpumask_var_node(&node_recorded_ids_map[node],
+						    GFP_KERNEL, node))
+				return -ENOMEM;
 
 			/* Record ids of CPU added at boot time */
-			cpumask_or(node_recorded_ids_map[node],
-				   node_recorded_ids_map[node],
-				   cpumask_of_node(node));
+			cpumask_copy(node_recorded_ids_map[node],
+				     cpumask_of_node(node));
 		}
 
 		of_reconfig_notifier_register(&pseries_smp_nb);
Signature · 1 line
2.23.0
Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nicholas Piggin

Slab is up at this point, using the bootmem allocator triggers a warning. Switch to using the regular cpumask allocator.

---

Fixes the warning for me. Thanks

Quoted 35 lines

This only matters when CONFIG_CPUMASK_OFFNODE=y, which has not been possible before on powerpc.

Thanks,
Nick

arch/powerpc/platforms/pseries/hotplug-cpu.c | 9 +++++----

1 file changed, 5 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +5 -4
index d646c22e94ab..78a70ba60d24 100644
@@ -1016,12 +1016,13 @@ static int __init pseries_cpu_hotplug_init(void)
 	/* Processors can be added/removed only on LPAR */
 	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		for_each_node(node) {
-			alloc_bootmem_cpumask_var(&node_recorded_ids_map[node]);
+			if (!alloc_cpumask_var_node(&node_recorded_ids_map[node],
+						    GFP_KERNEL, node))
+				return -ENOMEM;
 
 			/* Record ids of CPU added at boot time */
-			cpumask_or(node_recorded_ids_map[node],
-				   node_recorded_ids_map[node],
-				   cpumask_of_node(node));
+			cpumask_copy(node_recorded_ids_map[node],
+				     cpumask_of_node(node));
 		}
 
 		of_reconfig_notifier_register(&pseries_smp_nb);
Signature · 1 line
2.23.0
Reviewed-by on v1 1/1
#2 lore raw
In reply to Nicholas Piggin
Quoted 4 lines · Nicholas Piggin

Slab is up at this point, using the bootmem allocator triggers a warning. Switch to using the regular cpumask allocator.

Quoted 33 lines

---

This only matters when CONFIG_CPUMASK_OFFNODE=y, which has not been possible before on powerpc.

Thanks,
Nick

 arch/powerpc/platforms/pseries/hotplug-cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +5 -4
index d646c22e94ab..78a70ba60d24 100644
@@ -1016,12 +1016,13 @@ static int __init pseries_cpu_hotplug_init(void)
 	/* Processors can be added/removed only on LPAR */
 	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		for_each_node(node) {
-			alloc_bootmem_cpumask_var(&node_recorded_ids_map[node]);
+			if (!alloc_cpumask_var_node(&node_recorded_ids_map[node],
+						    GFP_KERNEL, node))
+				return -ENOMEM;
 
 			/* Record ids of CPU added at boot time */
-			cpumask_or(node_recorded_ids_map[node],
-				   node_recorded_ids_map[node],
-				   cpumask_of_node(node));
+			cpumask_copy(node_recorded_ids_map[node],
+				     cpumask_of_node(node));
 		}
 
 		of_reconfig_notifier_register(&pseries_smp_nb);
Reviewed-by on v1 1/1
#3 lore raw
In reply to Nicholas Piggin

Le 05/11/2021 à 14:29, Nicholas Piggin a écrit :

Quoted 8 lines

Slab is up at this point, using the bootmem allocator triggers a warning. Switch to using the regular cpumask allocator.

---

This only matters when CONFIG_CPUMASK_OFFNODE=y, which has not been possible before on powerpc.

Thanks Nick,

Quoted 29 lines

Thanks,
Nick

  arch/powerpc/platforms/pseries/hotplug-cpu.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +5 -4
index d646c22e94ab..78a70ba60d24 100644
@@ -1016,12 +1016,13 @@ static int __init pseries_cpu_hotplug_init(void)
  	/* Processors can be added/removed only on LPAR */
  	if (firmware_has_feature(FW_FEATURE_LPAR)) {
  		for_each_node(node) {
-			alloc_bootmem_cpumask_var(&node_recorded_ids_map[node]);
+			if (!alloc_cpumask_var_node(&node_recorded_ids_map[node],
+						    GFP_KERNEL, node))
+				return -ENOMEM;
 
  			/* Record ids of CPU added at boot time */
-			cpumask_or(node_recorded_ids_map[node],
-				   node_recorded_ids_map[node],
-				   cpumask_of_node(node));
+			cpumask_copy(node_recorded_ids_map[node],
+				     cpumask_of_node(node));
  		}
 
  		of_reconfig_notifier_register(&pseries_smp_nb);