Commit 917b1f78 authored by Brian Uhrain says's avatar Brian Uhrain says Committed by Linus Torvalds

[PATCH] alpha: SMP boot fixes

I've encountered two problems with 2.6.16 and newer kernels on my API CS20
(dual 833MHz Alpha 21264b processors).  The first is the kernel OOPSing
because of a NULL pointer dereference while trying to populate SysFS with the
CPU information.  The other is that only one processor was being brought up.
I've included a small Alpha-specific patch that fixes both problems.

The first problem was caused by the CPUs never being properly registered using
register_cpu(), the way it's done on other architectures.

The second problem has to do with the removal of hwrpb_cpu_present_mask in
arch/alpha/kernel/smp.c.  In setup_smp() in the 2.6.15 kernel sources,
hwrpb_cpu_present_mask has a bit set for each processor that is probed, and
afterwards cpu_present_mask is set to the cpumask for the boot CPU.  In the
same function of the same file in the 2.6.16 sources, instead of
hwrpb_cpu_present_mask being set, cpu_possible_map is updated for each probed
CPU.  cpu_present_mask is still set to the cpumask of the boot CPU afterwards.
 The problem lies in include/asm-alpha/smp.h, where cpu_possible_map is
#define'd to be cpu_present_mask.

Cleanups from: Ivan Kokshaysky <ink@jurassic.park.msu.ru>

 - cpu_present_mask and cpu_possible_map are essentially the same thing
   on alpha, as it doesn't support CPU hotplug;
 - allocate "struct cpu" only for present CPUs, like sparc64 does.
   Static array of "struct cpu" is just a waste of memory.
Signed-off-by: default avatarBrian Uhrain <buhrain@rosettastone.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1c08ca89
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/config.h> /* CONFIG_ALPHA_LCA etc */ #include <linux/config.h> /* CONFIG_ALPHA_LCA etc */
#include <linux/mc146818rtc.h> #include <linux/mc146818rtc.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/cpu.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -471,6 +472,22 @@ page_is_ram(unsigned long pfn) ...@@ -471,6 +472,22 @@ page_is_ram(unsigned long pfn)
return 0; return 0;
} }
static int __init
register_cpus(void)
{
int i;
for_each_possible_cpu(i) {
struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return -ENOMEM;
register_cpu(p, i, NULL);
}
return 0;
}
arch_initcall(register_cpus);
void __init void __init
setup_arch(char **cmdline_p) setup_arch(char **cmdline_p)
{ {
......
...@@ -439,7 +439,7 @@ setup_smp(void) ...@@ -439,7 +439,7 @@ setup_smp(void)
if ((cpu->flags & 0x1cc) == 0x1cc) { if ((cpu->flags & 0x1cc) == 0x1cc) {
smp_num_probed++; smp_num_probed++;
/* Assume here that "whami" == index */ /* Assume here that "whami" == index */
cpu_set(i, cpu_possible_map); cpu_set(i, cpu_present_mask);
cpu->pal_revision = boot_cpu_palrev; cpu->pal_revision = boot_cpu_palrev;
} }
...@@ -450,9 +450,8 @@ setup_smp(void) ...@@ -450,9 +450,8 @@ setup_smp(void)
} }
} else { } else {
smp_num_probed = 1; smp_num_probed = 1;
cpu_set(boot_cpuid, cpu_possible_map); cpu_set(boot_cpuid, cpu_present_mask);
} }
cpu_present_mask = cpumask_of_cpu(boot_cpuid);
printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
smp_num_probed, cpu_possible_map.bits[0]); smp_num_probed, cpu_possible_map.bits[0]);
...@@ -488,9 +487,8 @@ void __devinit ...@@ -488,9 +487,8 @@ void __devinit
smp_prepare_boot_cpu(void) smp_prepare_boot_cpu(void)
{ {
/* /*
* Mark the boot cpu (current cpu) as both present and online * Mark the boot cpu (current cpu) as online
*/ */
cpu_set(smp_processor_id(), cpu_present_mask);
cpu_set(smp_processor_id(), cpu_online_map); cpu_set(smp_processor_id(), cpu_online_map);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment