* [PATCH] Fix per-cpu allocation on oldworld SMP powermacs
@ 2007-06-07 12:42 Paul Mackerras
2007-06-07 22:26 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2007-06-07 12:42 UTC (permalink / raw)
To: linuxppc-dev
The per-cpu area(a) for the secondary CPU(s) isn't getting allocated
on old SMP powermacs that don't have the secondary CPU(s) listed in
the device tree, as per-cpu areas are now only allocated for CPUs in
the cpu_possible_map, and we aren't setting the bits for the secondary
CPU(s) until smp_prepare_cpus(), which is after per-cpu allocation.
Therefore this sets the bits for CPUs 1..3 in cpu_possible_map in
pmac_setup_arch, so they get per-cpu data allocated.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 07b1c4e..c519b2a 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -363,8 +363,19 @@ static void __init pmac_setup_arch(void)
smp_ops = &core99_smp_ops;
}
#ifdef CONFIG_PPC32
- else
+ else {
+ /*
+ * We have to set bits in cpu_possible_map here since the
+ * secondary CPU(s) aren't in the device tree, and
+ * setup_per_cpu_areas only allocates per-cpu data for
+ * CPUs in the cpu_possible_map.
+ */
+ int cpu;
+
+ for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu)
+ cpu_set(cpu, cpu_possible_map);
smp_ops = &psurge_smp_ops;
+ }
#endif
#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 686ed82..cb2d894 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -317,7 +317,6 @@ static int __init smp_psurge_probe(void)
ncpus = NR_CPUS;
for (i = 1; i < ncpus ; ++i) {
cpu_set(i, cpu_present_map);
- cpu_set(i, cpu_possible_map);
set_hard_smp_processor_id(i, i);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix per-cpu allocation on oldworld SMP powermacs
2007-06-07 12:42 [PATCH] Fix per-cpu allocation on oldworld SMP powermacs Paul Mackerras
@ 2007-06-07 22:26 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2007-06-07 22:26 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Thu, 2007-06-07 at 22:42 +1000, Paul Mackerras wrote:
> diff --git a/arch/powerpc/platforms/powermac/setup.c
> b/arch/powerpc/platforms/powermac/setup.c
> index 07b1c4e..c519b2a 100644
> --- a/arch/powerpc/platforms/powermac/setup.c
> +++ b/arch/powerpc/platforms/powermac/setup.c
> @@ -363,8 +363,19 @@ static void __init pmac_setup_arch(void)
> smp_ops = &core99_smp_ops;
> }
> #ifdef CONFIG_PPC32
> - else
> + else {
> + /*
> + * We have to set bits in cpu_possible_map here since
> the
> + * secondary CPU(s) aren't in the device tree, and
> + * setup_per_cpu_areas only allocates per-cpu data for
> + * CPUs in the cpu_possible_map.
> + */
> + int cpu;
> +
> + for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu)
> + cpu_set(cpu, cpu_possible_map);
> smp_ops = &psurge_smp_ops;
> + }
> #endif
> #endif /* CONFIG_SMP */
Why not use the result from probe() instead which returns the number of
possible CPUs ? That would catch more than just the powermac case ... we
might have similar issues when finally porting PReP over...
Ben.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-07 22:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 12:42 [PATCH] Fix per-cpu allocation on oldworld SMP powermacs Paul Mackerras
2007-06-07 22:26 ` Benjamin Herrenschmidt
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).