linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/5] powerpc/smp: Adjust nr_cpu_ids to cover all threads of a core
@ 2023-12-29 12:01 Michael Ellerman
  2023-12-29 12:01 ` [RFC PATCH 2/5] powerpc/smp: Increase nr_cpu_ids to include the boot CPU Michael Ellerman
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Michael Ellerman @ 2023-12-29 12:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Hari Bathini, Pingfan Liu, Pingfan Liu

If nr_cpu_ids is too low to include at least all the threads of a single
core adjust nr_cpu_ids upwards. This avoids triggering odd bugs in code
that assumes all threads of a core are available.

Cc: stable@vger.kernel.org
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/prom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 0b5878c3125b..58e80076bed5 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -375,6 +375,12 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	if (IS_ENABLED(CONFIG_PPC64))
 		boot_cpu_hwid = be32_to_cpu(intserv[found_thread]);
 
+	if (nr_cpu_ids % nthreads != 0) {
+		set_nr_cpu_ids(ALIGN(nr_cpu_ids, nthreads));
+		pr_warn("nr_cpu_ids was not a multiple of threads_per_core, adjusted to %d\n",
+			nr_cpu_ids);
+	}
+
 	/*
 	 * PAPR defines "logical" PVR values for cpus that
 	 * meet various levels of the architecture:
-- 
2.43.0


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

end of thread, other threads:[~2024-02-16  2:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-29 12:01 [RFC PATCH 1/5] powerpc/smp: Adjust nr_cpu_ids to cover all threads of a core Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 2/5] powerpc/smp: Increase nr_cpu_ids to include the boot CPU Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 3/5] powerpc/smp: Lookup avail once per device tree node Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 4/5] powerpc/smp: Factor out assign_threads() Michael Ellerman
2024-01-02  4:34   ` Aneesh Kumar K.V
2024-02-14 13:10     ` Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 5/5] powerpc/smp: Remap boot CPU onto core 0 if >= nr_cpu_ids Michael Ellerman
2023-12-29 12:07   ` Michael Ellerman
2024-01-02  0:51     ` Pingfan Liu
2024-02-13 20:16       ` Wen Xiong
2024-01-02  4:46   ` Aneesh Kumar K.V
2024-02-09 15:56     ` Jiri Bohac
2024-02-14 13:12       ` Michael Ellerman
2024-02-15 13:00 ` [RFC PATCH 1/5] powerpc/smp: Adjust nr_cpu_ids to cover all threads of a core Michael Ellerman
2024-02-16  2:42   ` Pingfan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).