All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-08 16:47 ` Waiman Long
  0 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-08 16:47 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Daniel Henrique Barboza, Nathan Lynch, Aneesh Kumar K.V
  Cc: linuxppc-dev, linux-kernel, Laurent Dufour, Nicholas Piggin,
	Zhang Xiaoxu, Waiman Long

It was found that the following warning message could be printed out when
booting the kernel on PowerPC systems that support LPAR:

[    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
[    0.129593] Modules linked in:
[    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
[    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
[    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
[    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
[    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
[    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
[    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
[    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
[    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
[    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
[    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
[    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
[    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
[    0.129723] Call Trace:
[    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
[    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
[    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
[    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
[    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
[    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
[    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
[    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
[    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64

The warning is printed in memblock_alloc_internal() because the slab
has been initialized when the initcalls are being processed. To
avoid the warning, change alloc_bootmem_cpumask_var() call in
pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
change cpumask_or() to cpumask_copy() or we will have to use
zalloc_cpumask_var().

Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
Signed-off-by: Waiman Long <longman@redhat.com>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 5ab44600c8d3..e8e08d916b16 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -864,12 +864,12 @@ 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]);
+			alloc_cpumask_var(&node_recorded_ids_map[node],
+					  GFP_KERNEL|GFP_NOWAIT);
 
 			/* 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);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-08 16:47 ` Waiman Long
  0 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-08 16:47 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Daniel Henrique Barboza, Nathan Lynch, Aneesh Kumar K.V
  Cc: linuxppc-dev, linux-kernel, Nicholas Piggin, Waiman Long,
	Laurent Dufour, Zhang Xiaoxu

It was found that the following warning message could be printed out when
booting the kernel on PowerPC systems that support LPAR:

[    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
[    0.129593] Modules linked in:
[    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
[    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
[    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
[    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
[    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
[    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
[    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
[    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
[    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
[    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
[    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
[    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
[    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
[    0.129723] Call Trace:
[    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
[    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
[    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
[    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
[    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
[    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
[    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
[    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
[    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64

The warning is printed in memblock_alloc_internal() because the slab
has been initialized when the initcalls are being processed. To
avoid the warning, change alloc_bootmem_cpumask_var() call in
pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
change cpumask_or() to cpumask_copy() or we will have to use
zalloc_cpumask_var().

Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
Signed-off-by: Waiman Long <longman@redhat.com>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 5ab44600c8d3..e8e08d916b16 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -864,12 +864,12 @@ 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]);
+			alloc_cpumask_var(&node_recorded_ids_map[node],
+					  GFP_KERNEL|GFP_NOWAIT);
 
 			/* 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);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-08 16:47 ` Waiman Long
@ 2021-11-08 23:06   ` Nathan Lynch
  -1 siblings, 0 replies; 16+ messages in thread
From: Nathan Lynch @ 2021-11-08 23:06 UTC (permalink / raw)
  To: Waiman Long
  Cc: linuxppc-dev, linux-kernel, Laurent Dufour, Nicholas Piggin,
	Zhang Xiaoxu, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, Daniel Henrique Barboza, Aneesh Kumar K.V

Waiman Long <longman@redhat.com> writes:

> It was found that the following warning message could be printed out when
> booting the kernel on PowerPC systems that support LPAR:
>
> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
> [    0.129593] Modules linked in:
> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
> [    0.129723] Call Trace:
> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>
> The warning is printed in memblock_alloc_internal() because the slab
> has been initialized when the initcalls are being processed.

Looks like CONFIG_CPUMASK_OFFSTACK=y is necessary for the warning to
trigger... guess that explains how it's escaped notice.

> To
> avoid the warning, change alloc_bootmem_cpumask_var() call in
> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
> change cpumask_or() to cpumask_copy() or we will have to use
> zalloc_cpumask_var().

Makes sense.


> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index 5ab44600c8d3..e8e08d916b16 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -864,12 +864,12 @@ 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]);
> +			alloc_cpumask_var(&node_recorded_ids_map[node],
> +					  GFP_KERNEL|GFP_NOWAIT);

This isn't atomic context, so GFP_KERNEL alone should be used.

Otherwise this change looks right to me.

>  
>  			/* 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);
> -- 
> 2.27.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-08 23:06   ` Nathan Lynch
  0 siblings, 0 replies; 16+ messages in thread
From: Nathan Lynch @ 2021-11-08 23:06 UTC (permalink / raw)
  To: Waiman Long
  Cc: linuxppc-dev, Daniel Henrique Barboza, linux-kernel,
	Nicholas Piggin, Paul Mackerras, Aneesh Kumar K.V,
	Laurent Dufour, Zhang Xiaoxu

Waiman Long <longman@redhat.com> writes:

> It was found that the following warning message could be printed out when
> booting the kernel on PowerPC systems that support LPAR:
>
> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
> [    0.129593] Modules linked in:
> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
> [    0.129723] Call Trace:
> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>
> The warning is printed in memblock_alloc_internal() because the slab
> has been initialized when the initcalls are being processed.

Looks like CONFIG_CPUMASK_OFFSTACK=y is necessary for the warning to
trigger... guess that explains how it's escaped notice.

> To
> avoid the warning, change alloc_bootmem_cpumask_var() call in
> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
> change cpumask_or() to cpumask_copy() or we will have to use
> zalloc_cpumask_var().

Makes sense.


> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index 5ab44600c8d3..e8e08d916b16 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -864,12 +864,12 @@ 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]);
> +			alloc_cpumask_var(&node_recorded_ids_map[node],
> +					  GFP_KERNEL|GFP_NOWAIT);

This isn't atomic context, so GFP_KERNEL alone should be used.

Otherwise this change looks right to me.

>  
>  			/* 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);
> -- 
> 2.27.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-08 16:47 ` Waiman Long
@ 2021-11-09  1:04   ` Michael Ellerman
  -1 siblings, 0 replies; 16+ messages in thread
From: Michael Ellerman @ 2021-11-09  1:04 UTC (permalink / raw)
  To: Waiman Long, Benjamin Herrenschmidt, Paul Mackerras,
	Daniel Henrique Barboza, Nathan Lynch, Aneesh Kumar K.V
  Cc: linuxppc-dev, linux-kernel, Nicholas Piggin, Waiman Long,
	Laurent Dufour, Zhang Xiaoxu

Waiman Long <longman@redhat.com> writes:
> It was found that the following warning message could be printed out when
> booting the kernel on PowerPC systems that support LPAR:
>
> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
> [    0.129593] Modules linked in:
> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
> [    0.129723] Call Trace:
> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>
> The warning is printed in memblock_alloc_internal() because the slab
> has been initialized when the initcalls are being processed. To
> avoid the warning, change alloc_bootmem_cpumask_var() call in
> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
> change cpumask_or() to cpumask_copy() or we will have to use
> zalloc_cpumask_var().
>
> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)


This looks similar to the patch Nick sent recently:

  https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/

cheers

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-09  1:04   ` Michael Ellerman
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Ellerman @ 2021-11-09  1:04 UTC (permalink / raw)
  To: Waiman Long, Benjamin Herrenschmidt, Paul Mackerras,
	Daniel Henrique Barboza, Nathan Lynch, Aneesh Kumar K.V
  Cc: linuxppc-dev, linux-kernel, Laurent Dufour, Nicholas Piggin,
	Zhang Xiaoxu, Waiman Long

Waiman Long <longman@redhat.com> writes:
> It was found that the following warning message could be printed out when
> booting the kernel on PowerPC systems that support LPAR:
>
> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
> [    0.129593] Modules linked in:
> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
> [    0.129723] Call Trace:
> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>
> The warning is printed in memblock_alloc_internal() because the slab
> has been initialized when the initcalls are being processed. To
> avoid the warning, change alloc_bootmem_cpumask_var() call in
> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
> change cpumask_or() to cpumask_copy() or we will have to use
> zalloc_cpumask_var().
>
> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)


This looks similar to the patch Nick sent recently:

  https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/

cheers

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-09  1:04   ` Michael Ellerman
@ 2021-11-09  1:43     ` Waiman Long
  -1 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-09  1:43 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Daniel Henrique Barboza, Nathan Lynch, Aneesh Kumar K.V
  Cc: linuxppc-dev, linux-kernel, Laurent Dufour, Nicholas Piggin,
	Zhang Xiaoxu

On 11/8/21 20:04, Michael Ellerman wrote:
> Waiman Long <longman@redhat.com> writes:
>> It was found that the following warning message could be printed out when
>> booting the kernel on PowerPC systems that support LPAR:
>>
>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>> [    0.129593] Modules linked in:
>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>> [    0.129723] Call Trace:
>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>
>> The warning is printed in memblock_alloc_internal() because the slab
>> has been initialized when the initcalls are being processed. To
>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>> change cpumask_or() to cpumask_copy() or we will have to use
>> zalloc_cpumask_var().
>>
>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> This looks similar to the patch Nick sent recently:
>
>    https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/

I was not aware of Nick's patch. Since a fix is pending, I am 
withdrawing mime.

Cheers,
Longman


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-09  1:43     ` Waiman Long
  0 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-09  1:43 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Daniel Henrique Barboza, Nathan Lynch, Aneesh Kumar K.V
  Cc: Zhang Xiaoxu, Laurent Dufour, linuxppc-dev, linux-kernel,
	Nicholas Piggin

On 11/8/21 20:04, Michael Ellerman wrote:
> Waiman Long <longman@redhat.com> writes:
>> It was found that the following warning message could be printed out when
>> booting the kernel on PowerPC systems that support LPAR:
>>
>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>> [    0.129593] Modules linked in:
>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>> [    0.129723] Call Trace:
>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>
>> The warning is printed in memblock_alloc_internal() because the slab
>> has been initialized when the initcalls are being processed. To
>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>> change cpumask_or() to cpumask_copy() or we will have to use
>> zalloc_cpumask_var().
>>
>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> This looks similar to the patch Nick sent recently:
>
>    https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/

I was not aware of Nick's patch. Since a fix is pending, I am 
withdrawing mime.

Cheers,
Longman


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-09  1:04   ` Michael Ellerman
@ 2021-11-09  1:46     ` Nicholas Piggin
  -1 siblings, 0 replies; 16+ messages in thread
From: Nicholas Piggin @ 2021-11-09  1:46 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Benjamin Herrenschmidt,
	Daniel
	 Henrique Barboza, Waiman Long, Michael Ellerman, Nathan Lynch,
	Paul Mackerras
  Cc: Laurent
 Dufour, linux-kernel, linuxppc-dev, Zhang
 Xiaoxu

Excerpts from Michael Ellerman's message of November 9, 2021 11:04 am:
> Waiman Long <longman@redhat.com> writes:
>> It was found that the following warning message could be printed out when
>> booting the kernel on PowerPC systems that support LPAR:
>>
>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>> [    0.129593] Modules linked in:
>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>> [    0.129723] Call Trace:
>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>
>> The warning is printed in memblock_alloc_internal() because the slab
>> has been initialized when the initcalls are being processed. To
>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>> change cpumask_or() to cpumask_copy() or we will have to use
>> zalloc_cpumask_var().
>>
>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>  arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> 
> This looks similar to the patch Nick sent recently:
> 
>   https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/

Ah, you get CONFIG_CPUMASK_OFFSTACK=y if CONFIG_DEBUG_PER_CPU_MAPS=y.
I was wondering how Waiman found it.

Differences between the two patches are error checking - no big deal but 
we should just do it. And GFP_NOWAIT - is this required here?

Thanks,
Nick

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-09  1:46     ` Nicholas Piggin
  0 siblings, 0 replies; 16+ messages in thread
From: Nicholas Piggin @ 2021-11-09  1:46 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Benjamin Herrenschmidt,
	Daniel
	 Henrique Barboza, Waiman Long, Michael Ellerman, Nathan Lynch,
	Paul Mackerras
  Cc: Zhang
 Xiaoxu, Laurent
 Dufour, linuxppc-dev, linux-kernel

Excerpts from Michael Ellerman's message of November 9, 2021 11:04 am:
> Waiman Long <longman@redhat.com> writes:
>> It was found that the following warning message could be printed out when
>> booting the kernel on PowerPC systems that support LPAR:
>>
>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>> [    0.129593] Modules linked in:
>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>> [    0.129723] Call Trace:
>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>
>> The warning is printed in memblock_alloc_internal() because the slab
>> has been initialized when the initcalls are being processed. To
>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>> change cpumask_or() to cpumask_copy() or we will have to use
>> zalloc_cpumask_var().
>>
>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>  arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> 
> This looks similar to the patch Nick sent recently:
> 
>   https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/

Ah, you get CONFIG_CPUMASK_OFFSTACK=y if CONFIG_DEBUG_PER_CPU_MAPS=y.
I was wondering how Waiman found it.

Differences between the two patches are error checking - no big deal but 
we should just do it. And GFP_NOWAIT - is this required here?

Thanks,
Nick

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-08 23:06   ` Nathan Lynch
@ 2021-11-09  1:48     ` Waiman Long
  -1 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-09  1:48 UTC (permalink / raw)
  To: Nathan Lynch
  Cc: linuxppc-dev, linux-kernel, Laurent Dufour, Nicholas Piggin,
	Zhang Xiaoxu, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, Daniel Henrique Barboza, Aneesh Kumar K.V


On 11/8/21 18:06, Nathan Lynch wrote:
> Waiman Long <longman@redhat.com> writes:
>
>> It was found that the following warning message could be printed out when
>> booting the kernel on PowerPC systems that support LPAR:
>>
>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>> [    0.129593] Modules linked in:
>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>> [    0.129723] Call Trace:
>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>
>> The warning is printed in memblock_alloc_internal() because the slab
>> has been initialized when the initcalls are being processed.
> Looks like CONFIG_CPUMASK_OFFSTACK=y is necessary for the warning to
> trigger... guess that explains how it's escaped notice.
>
>> To
>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>> change cpumask_or() to cpumask_copy() or we will have to use
>> zalloc_cpumask_var().
> Makes sense.
>
>
>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
>> index 5ab44600c8d3..e8e08d916b16 100644
>> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
>> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
>> @@ -864,12 +864,12 @@ 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]);
>> +			alloc_cpumask_var(&node_recorded_ids_map[node],
>> +					  GFP_KERNEL|GFP_NOWAIT);
> This isn't atomic context, so GFP_KERNEL alone should be used.
>
> Otherwise this change looks right to me.

I added GFP_NOWAIT because the kzalloc_node() call from 
memblock_alloc_internal() uses GFP_NOWAIT. That makes sense as you don't 
want to wait in an initcall. Anyway, that shouldn't really matter as 
there should be enough free memory at bootup time to satisfy the request 
without waiting. So GFP_NOWAIT may not be necessary.

Cheers,
Longman


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-09  1:48     ` Waiman Long
  0 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-09  1:48 UTC (permalink / raw)
  To: Nathan Lynch
  Cc: linuxppc-dev, Daniel Henrique Barboza, linux-kernel,
	Nicholas Piggin, Paul Mackerras, Aneesh Kumar K.V,
	Laurent Dufour, Zhang Xiaoxu


On 11/8/21 18:06, Nathan Lynch wrote:
> Waiman Long <longman@redhat.com> writes:
>
>> It was found that the following warning message could be printed out when
>> booting the kernel on PowerPC systems that support LPAR:
>>
>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>> [    0.129593] Modules linked in:
>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>> [    0.129723] Call Trace:
>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>
>> The warning is printed in memblock_alloc_internal() because the slab
>> has been initialized when the initcalls are being processed.
> Looks like CONFIG_CPUMASK_OFFSTACK=y is necessary for the warning to
> trigger... guess that explains how it's escaped notice.
>
>> To
>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>> change cpumask_or() to cpumask_copy() or we will have to use
>> zalloc_cpumask_var().
> Makes sense.
>
>
>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
>> index 5ab44600c8d3..e8e08d916b16 100644
>> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
>> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
>> @@ -864,12 +864,12 @@ 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]);
>> +			alloc_cpumask_var(&node_recorded_ids_map[node],
>> +					  GFP_KERNEL|GFP_NOWAIT);
> This isn't atomic context, so GFP_KERNEL alone should be used.
>
> Otherwise this change looks right to me.

I added GFP_NOWAIT because the kzalloc_node() call from 
memblock_alloc_internal() uses GFP_NOWAIT. That makes sense as you don't 
want to wait in an initcall. Anyway, that shouldn't really matter as 
there should be enough free memory at bootup time to satisfy the request 
without waiting. So GFP_NOWAIT may not be necessary.

Cheers,
Longman


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-09  1:46     ` Nicholas Piggin
@ 2021-11-09  1:51       ` Waiman Long
  -1 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-09  1:51 UTC (permalink / raw)
  To: Nicholas Piggin, Aneesh Kumar K.V, Benjamin Herrenschmidt,
	Daniel Henrique Barboza, Michael Ellerman, Nathan Lynch,
	Paul Mackerras
  Cc: Laurent Dufour, linux-kernel, linuxppc-dev, Zhang Xiaoxu


On 11/8/21 20:46, Nicholas Piggin wrote:
> Excerpts from Michael Ellerman's message of November 9, 2021 11:04 am:
>> Waiman Long <longman@redhat.com> writes:
>>> It was found that the following warning message could be printed out when
>>> booting the kernel on PowerPC systems that support LPAR:
>>>
>>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>>> [    0.129593] Modules linked in:
>>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>>> [    0.129723] Call Trace:
>>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>>
>>> The warning is printed in memblock_alloc_internal() because the slab
>>> has been initialized when the initcalls are being processed. To
>>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>>> change cpumask_or() to cpumask_copy() or we will have to use
>>> zalloc_cpumask_var().
>>>
>>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>>> Signed-off-by: Waiman Long <longman@redhat.com>
>>> ---
>>>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> This looks similar to the patch Nick sent recently:
>>
>>    https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/
> Ah, you get CONFIG_CPUMASK_OFFSTACK=y if CONFIG_DEBUG_PER_CPU_MAPS=y.
> I was wondering how Waiman found it.
>
> Differences between the two patches are error checking - no big deal but
> we should just do it. And GFP_NOWAIT - is this required here?

As I have replied in another thread, I added it because it was used in 
memblock_alloc_internal().

Cheers,
Longman


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-09  1:51       ` Waiman Long
  0 siblings, 0 replies; 16+ messages in thread
From: Waiman Long @ 2021-11-09  1:51 UTC (permalink / raw)
  To: Nicholas Piggin, Aneesh Kumar K.V, Benjamin Herrenschmidt,
	Daniel Henrique Barboza, Michael Ellerman, Nathan Lynch,
	Paul Mackerras
  Cc: Zhang Xiaoxu, Laurent Dufour, linuxppc-dev, linux-kernel


On 11/8/21 20:46, Nicholas Piggin wrote:
> Excerpts from Michael Ellerman's message of November 9, 2021 11:04 am:
>> Waiman Long <longman@redhat.com> writes:
>>> It was found that the following warning message could be printed out when
>>> booting the kernel on PowerPC systems that support LPAR:
>>>
>>> [    0.129584] WARNING: CPU: 0 PID: 1 at mm/memblock.c:1451 memblock_alloc_internal+0x5c/0x104
>>> [    0.129593] Modules linked in:
>>> [    0.129598] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-11.el9.ppc64le+debug #1
>>> [    0.129605] NIP:  c000000002040134 LR: c00000000204011c CTR: c0000000020241a8
>>> [    0.129610] REGS: c000000005637760 TRAP: 0700   Not tainted  (5.14.0-11.el9.ppc64le+debug)
>>> [    0.129616] MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000222  XER: 00000002
>>> [    0.129635] CFAR: c0000000004d1cf4 IRQMASK: 0
>>> [    0.129635] GPR00: c00000000204011c c000000005637a00 c000000002c94d00 0000000000000001
>>> [    0.129635] GPR04: 0000000000000080 0000000000000000 0000000000000000 ffffffffffffffff
>>> [    0.129635] GPR08: 0000000000000000 0000000000000003 c00000000205ac64 0000000000080000
>>> [    0.129635] GPR12: 0000000000000000 c0000000049d0000 c000000000013078 0000000000000000
>>> [    0.129635] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>>> [    0.129635] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>>> [    0.129635] GPR24: c000000002003808 c00000000146f7b8 0000000000000000 0000000000000100
>>> [    0.129635] GPR28: c000000002d7cf80 0000000000000000 0000000000000008 0000000000000000
>>> [    0.129710] NIP [c000000002040134] memblock_alloc_internal+0x5c/0x104
>>> [    0.129717] LR [c00000000204011c] memblock_alloc_internal+0x44/0x104
>>> [    0.129723] Call Trace:
>>> [    0.129726] [c000000005637a00] [c000000005637a40] 0xc000000005637a40 (unreliable)
>>> [    0.129735] [c000000005637a60] [c0000000020404d8] memblock_alloc_try_nid+0x94/0xcc
>>> [    0.129743] [c000000005637af0] [c00000000205ac64] alloc_bootmem_cpumask_var+0x4c/0x9c
>>> [    0.129751] [c000000005637b60] [c0000000020242e0] __machine_initcall_pseries_pseries_cpu_hotplug_init+0x138/0x1d8
>>> [    0.129760] [c000000005637bf0] [c000000000012404] do_one_initcall+0xa4/0x4f0
>>> [    0.129768] [c000000005637cd0] [c000000002005358] do_initcalls+0x140/0x18c
>>> [    0.129776] [c000000005637d80] [c0000000020055b8] kernel_init_freeable+0x178/0x1d0
>>> [    0.129783] [c000000005637db0] [c0000000000130a0] kernel_init+0x30/0x190
>>> [    0.129790] [c000000005637e10] [c00000000000cef4] ret_from_kernel_thread+0x5c/0x64
>>>
>>> The warning is printed in memblock_alloc_internal() because the slab
>>> has been initialized when the initcalls are being processed. To
>>> avoid the warning, change alloc_bootmem_cpumask_var() call in
>>> pseries_cpu_hotplug_init() to alloc_cpumask_var() instead. Also
>>> change cpumask_or() to cpumask_copy() or we will have to use
>>> zalloc_cpumask_var().
>>>
>>> Fixes: bd1dd4c5f528 ("powerpc/pseries: Prevent free CPU ids being reused on another node")
>>> Signed-off-by: Waiman Long <longman@redhat.com>
>>> ---
>>>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> This looks similar to the patch Nick sent recently:
>>
>>    https://lore.kernel.org/linuxppc-dev/20211105132923.1582514-1-npiggin@gmail.com/
> Ah, you get CONFIG_CPUMASK_OFFSTACK=y if CONFIG_DEBUG_PER_CPU_MAPS=y.
> I was wondering how Waiman found it.
>
> Differences between the two patches are error checking - no big deal but
> we should just do it. And GFP_NOWAIT - is this required here?

As I have replied in another thread, I added it because it was used in 
memblock_alloc_internal().

Cheers,
Longman


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
  2021-11-09  1:51       ` Waiman Long
@ 2021-11-09  2:07         ` Nathan Lynch
  -1 siblings, 0 replies; 16+ messages in thread
From: Nathan Lynch @ 2021-11-09  2:07 UTC (permalink / raw)
  To: Waiman Long, Nicholas Piggin, Aneesh Kumar K.V,
	Benjamin Herrenschmidt, Daniel Henrique Barboza,
	Michael Ellerman, Paul Mackerras
  Cc: Zhang Xiaoxu, Laurent Dufour, linuxppc-dev, linux-kernel

Waiman Long <longman@redhat.com> writes:
> On 11/8/21 20:46, Nicholas Piggin wrote:
>> Differences between the two patches are error checking - no big deal but
>> we should just do it. And GFP_NOWAIT - is this required here?
>
> As I have replied in another thread, I added it because it was used in 
> memblock_alloc_internal().

From the pseries code's point of view, that's an incidental property of
the misuse detection branch in memblock_alloc_internal() -- I'd
speculate to make it robust for calls from atomic context. GFP_NOWAIT is
not needed here.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init()
@ 2021-11-09  2:07         ` Nathan Lynch
  0 siblings, 0 replies; 16+ messages in thread
From: Nathan Lynch @ 2021-11-09  2:07 UTC (permalink / raw)
  To: Waiman Long, Nicholas Piggin, Aneesh Kumar K.V,
	Benjamin Herrenschmidt, Daniel Henrique Barboza,
	Michael Ellerman, Paul Mackerras
  Cc: linuxppc-dev, Laurent Dufour, Zhang Xiaoxu, linux-kernel

Waiman Long <longman@redhat.com> writes:
> On 11/8/21 20:46, Nicholas Piggin wrote:
>> Differences between the two patches are error checking - no big deal but
>> we should just do it. And GFP_NOWAIT - is this required here?
>
> As I have replied in another thread, I added it because it was used in 
> memblock_alloc_internal().

From the pseries code's point of view, that's an incidental property of
the misuse detection branch in memblock_alloc_internal() -- I'd
speculate to make it robust for calls from atomic context. GFP_NOWAIT is
not needed here.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-11-09  2:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 16:47 [PATCH] powerpc/pseries/cpuhp: Use alloc_cpumask_var() in pseries_cpu_hotplug_init() Waiman Long
2021-11-08 16:47 ` Waiman Long
2021-11-08 23:06 ` Nathan Lynch
2021-11-08 23:06   ` Nathan Lynch
2021-11-09  1:48   ` Waiman Long
2021-11-09  1:48     ` Waiman Long
2021-11-09  1:04 ` Michael Ellerman
2021-11-09  1:04   ` Michael Ellerman
2021-11-09  1:43   ` Waiman Long
2021-11-09  1:43     ` Waiman Long
2021-11-09  1:46   ` Nicholas Piggin
2021-11-09  1:46     ` Nicholas Piggin
2021-11-09  1:51     ` Waiman Long
2021-11-09  1:51       ` Waiman Long
2021-11-09  2:07       ` Nathan Lynch
2021-11-09  2:07         ` Nathan Lynch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.