mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pseries/hotplug: Add CPU-to-node mappings for all present CPUs
@ 2026-10-12 15:55 Srikar Dronamraju
  2026-10-14  7:31 ` Nysal Jan K.A.
  2026-10-16  9:41 ` samir
  0 siblings, 2 replies; 3+ messages in thread
From: Srikar Dronamraju @ 2026-10-12 15:55 UTC (permalink / raw)
  To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP)
  Cc: Srikar Dronamraju, Samir Mulani, linux-kernel

When cores are added while the system is running in a lower SMT mode,
some threads of those cores remain offline. Moving the system to a
higher SMT mode later fails to online those threads.

For example, on a system with four cores:

  1. ppc64_cpu --smt=off
  2. nproc
       expected: 4
  3. ppc64_cpu --smt
       expected/actual: "SMT is off"
  4. drmgr -c cpu -a -q 4
  5. ppc64_cpu --smt
       expected/actual: "SMT is off"
  6. ppc64_cpu --smt=8
  7. ppc64_cpu --smt
       expected: SMT=8
       actual:   SMT=1: 4-7; SMT=8: 0-3
  8. nproc
       expected: 64
       actual:   36

Post commit d1099e2276df ("powerpc/pseries: Honour current SMT state
when DLPAR onlining CPUs"), when new CPUs are added, the CPU-to-node
mapping is currently updated only for CPUs that are immediately onlined.
CPUs that are made present but remain offline due to the current SMT
mode therefore do not get a CPU-to-node mapping.

When those CPUs are subsequently onlined after switching to a higher
SMT mode, the online operation fails because the required CPU-to-node
mapping is missing.

Update the CPU-to-node mapping before applying the SMT restrictions so
that all newly present CPUs have a node mapping, including CPUs that
remain offline in the current SMT mode.

Fixes: d1099e2276df ("powerpc/pseries: Honour current SMT state when DLPAR onlining CPUs")
Reported-by: Samir Mulani <samir@linux.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index bc6926dbf148..b5dc942eec63 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -402,6 +402,7 @@ static int dlpar_online_cpu(struct device_node *dn)
 			if (get_hard_smp_processor_id(cpu) != thread)
 				continue;
 
+			find_and_update_cpu_nid(cpu);
 			if (!topology_is_primary_thread(cpu)) {
 				if (cpu_smt_control != CPU_SMT_ENABLED)
 					break;
@@ -410,7 +411,6 @@ static int dlpar_online_cpu(struct device_node *dn)
 			}
 
 			cpu_maps_update_done();
-			find_and_update_cpu_nid(cpu);
 			rc = device_online(get_cpu_device(cpu));
 			if (rc) {
 				dlpar_offline_cpu(dn);
-- 
2.43.7


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

* Re: [PATCH] pseries/hotplug: Add CPU-to-node mappings for all present CPUs
  2026-10-12 15:55 [PATCH] pseries/hotplug: Add CPU-to-node mappings for all present CPUs Srikar Dronamraju
@ 2026-10-14  7:31 ` Nysal Jan K.A.
  2026-10-16  9:41 ` samir
  1 sibling, 0 replies; 3+ messages in thread
From: Nysal Jan K.A. @ 2026-10-14  7:31 UTC (permalink / raw)
  To: Srikar Dronamraju, linuxppc-dev, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP)
  Cc: Samir Mulani, linux-kernel

On Mon, Oct 12, 2026 at 09:25:49PM +0530, Srikar Dronamraju wrote:
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index bc6926dbf148..b5dc942eec63 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -402,6 +402,7 @@ static int dlpar_online_cpu(struct device_node *dn)
>  			if (get_hard_smp_processor_id(cpu) != thread)
>  				continue;
>  
> +			find_and_update_cpu_nid(cpu);
>  			if (!topology_is_primary_thread(cpu)) {
>  				if (cpu_smt_control != CPU_SMT_ENABLED)
>  					break;

The fix looks correct to me. As an improvement, would limiting only the primary
thread to making the H_HOME_NODE_ASSOCIATIVITY hcall perhaps be quicker?
The primary thread can then update the nid of its sibling threads?

--Nysal

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

* Re: [PATCH] pseries/hotplug: Add CPU-to-node mappings for all present CPUs
  2026-10-12 15:55 [PATCH] pseries/hotplug: Add CPU-to-node mappings for all present CPUs Srikar Dronamraju
  2026-10-14  7:31 ` Nysal Jan K.A.
@ 2026-10-16  9:41 ` samir
  1 sibling, 0 replies; 3+ messages in thread
From: samir @ 2026-10-16  9:41 UTC (permalink / raw)
  To: Srikar Dronamraju, linuxppc-dev, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP)
  Cc: linux-kernel

Hello Srikar,

On 12/10/26 9:25 pm, Srikar Dronamraju wrote:
> When cores are added while the system is running in a lower SMT mode,
> some threads of those cores remain offline. Moving the system to a
> higher SMT mode later fails to online those threads.
>
> For example, on a system with four cores:
>
>    1. ppc64_cpu --smt=off
>    2. nproc
>         expected: 4
>    3. ppc64_cpu --smt
>         expected/actual: "SMT is off"
>    4. drmgr -c cpu -a -q 4
>    5. ppc64_cpu --smt
>         expected/actual: "SMT is off"
>    6. ppc64_cpu --smt=8
>    7. ppc64_cpu --smt
>         expected: SMT=8
>         actual:   SMT=1: 4-7; SMT=8: 0-3
>    8. nproc
>         expected: 64
>         actual:   36
>
> Post commit d1099e2276df ("powerpc/pseries: Honour current SMT state
> when DLPAR onlining CPUs"), when new CPUs are added, the CPU-to-node
> mapping is currently updated only for CPUs that are immediately onlined.
> CPUs that are made present but remain offline due to the current SMT
> mode therefore do not get a CPU-to-node mapping.
>
> When those CPUs are subsequently onlined after switching to a higher
> SMT mode, the online operation fails because the required CPU-to-node
> mapping is missing.
>
> Update the CPU-to-node mapping before applying the SMT restrictions so
> that all newly present CPUs have a node mapping, including CPUs that
> remain offline in the current SMT mode.
>
> Fixes: d1099e2276df ("powerpc/pseries: Honour current SMT state when DLPAR onlining CPUs")
> Reported-by: Samir Mulani <samir@linux.ibm.com>
> Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> ---
>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index bc6926dbf148..b5dc942eec63 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -402,6 +402,7 @@ static int dlpar_online_cpu(struct device_node *dn)
>   			if (get_hard_smp_processor_id(cpu) != thread)
>   				continue;
>   
> +			find_and_update_cpu_nid(cpu);
>   			if (!topology_is_primary_thread(cpu)) {
>   				if (cpu_smt_control != CPU_SMT_ENABLED)
>   					break;
> @@ -410,7 +411,6 @@ static int dlpar_online_cpu(struct device_node *dn)
>   			}
>   
>   			cpu_maps_update_done();
> -			find_and_update_cpu_nid(cpu);
>   			rc = device_online(get_cpu_device(cpu));
>   			if (rc) {
>   				dlpar_offline_cpu(dn);

I have verified the patch, and no issues were observed during testing. 
The patch has been tested successfully.


Please add the following Tested-by tag:
Tested-by: Samir Mulani <samir@linux.ibm.com>

Thank you for the fix!

Regards,
Samir

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

end of thread, other threads:[~2026-10-16  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 15:55 [PATCH] pseries/hotplug: Add CPU-to-node mappings for all present CPUs Srikar Dronamraju
2026-10-14  7:31 ` Nysal Jan K.A.
2026-10-16  9:41 ` samir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®