diff options
author | Matt Evans <matt@ozlabs.org> | 2011-05-25 14:09:12 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-06-17 02:19:51 -0400 |
commit | 7ac87abb8166b99584149fcfb2efef5773a078e9 (patch) | |
tree | 626ccec24e00720ada0bd8f967922d935f0eeca8 /arch/powerpc | |
parent | 32d206eb5637d8cf73d9c70f7680de2a7193ce8b (diff) |
powerpc: Fix early boot accounting of CPUs
smp_release_cpus() waits for all cpus (including the bootcpu) due to an
off-by-one count on boot_cpu_count (which is all CPUs). This patch replaces
that with spinning_secondaries (which is all secondary CPUs).
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/smp.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 6 |
5 files changed, 13 insertions, 6 deletions
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index 11eb404b5606..b2a4c2d0b7f2 100644 --- a/arch/powerpc/include/asm/smp.h +++ b/arch/powerpc/include/asm/smp.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <asm/percpu.h> | 30 | #include <asm/percpu.h> |
31 | 31 | ||
32 | extern int boot_cpuid; | 32 | extern int boot_cpuid; |
33 | extern int boot_cpu_count; | 33 | extern int spinning_secondaries; |
34 | 34 | ||
35 | extern void cpu_die(void); | 35 | extern void cpu_die(void); |
36 | 36 | ||
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index ba504099844a..3564c49c683e 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -255,7 +255,7 @@ generic_secondary_common_init: | |||
255 | mtctr r23 | 255 | mtctr r23 |
256 | bctrl | 256 | bctrl |
257 | 257 | ||
258 | 3: LOAD_REG_ADDR(r3, boot_cpu_count) /* Decrement boot_cpu_count */ | 258 | 3: LOAD_REG_ADDR(r3, spinning_secondaries) /* Decrement spinning_secondaries */ |
259 | lwarx r4,0,r3 | 259 | lwarx r4,0,r3 |
260 | subi r4,r4,1 | 260 | subi r4,r4,1 |
261 | stwcx. r4,0,r3 | 261 | stwcx. r4,0,r3 |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index f2c906b1d8d3..534c50359e06 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -69,6 +69,7 @@ unsigned long tce_alloc_start, tce_alloc_end; | |||
69 | u64 ppc64_rma_size; | 69 | u64 ppc64_rma_size; |
70 | #endif | 70 | #endif |
71 | static phys_addr_t first_memblock_size; | 71 | static phys_addr_t first_memblock_size; |
72 | static int __initdata boot_cpu_count; | ||
72 | 73 | ||
73 | static int __init early_parse_mem(char *p) | 74 | static int __init early_parse_mem(char *p) |
74 | { | 75 | { |
@@ -748,6 +749,13 @@ void __init early_init_devtree(void *params) | |||
748 | */ | 749 | */ |
749 | of_scan_flat_dt(early_init_dt_scan_cpus, NULL); | 750 | of_scan_flat_dt(early_init_dt_scan_cpus, NULL); |
750 | 751 | ||
752 | #if defined(CONFIG_SMP) && defined(CONFIG_PPC64) | ||
753 | /* We'll later wait for secondaries to check in; there are | ||
754 | * NCPUS-1 non-boot CPUs :-) | ||
755 | */ | ||
756 | spinning_secondaries = boot_cpu_count - 1; | ||
757 | #endif | ||
758 | |||
751 | DBG(" <- early_init_devtree()\n"); | 759 | DBG(" <- early_init_devtree()\n"); |
752 | } | 760 | } |
753 | 761 | ||
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 620d792b52e4..1d2fbc905303 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -48,7 +48,6 @@ extern void bootx_init(unsigned long r4, unsigned long phys); | |||
48 | 48 | ||
49 | int boot_cpuid = -1; | 49 | int boot_cpuid = -1; |
50 | EXPORT_SYMBOL_GPL(boot_cpuid); | 50 | EXPORT_SYMBOL_GPL(boot_cpuid); |
51 | int __initdata boot_cpu_count; | ||
52 | int boot_cpuid_phys; | 51 | int boot_cpuid_phys; |
53 | 52 | ||
54 | int smp_hw_index[NR_CPUS]; | 53 | int smp_hw_index[NR_CPUS]; |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index a88bf2713d41..05769190e7f1 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -73,7 +73,7 @@ | |||
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | int boot_cpuid = 0; | 75 | int boot_cpuid = 0; |
76 | int __initdata boot_cpu_count; | 76 | int __initdata spinning_secondaries; |
77 | u64 ppc64_pft_size; | 77 | u64 ppc64_pft_size; |
78 | 78 | ||
79 | /* Pick defaults since we might want to patch instructions | 79 | /* Pick defaults since we might want to patch instructions |
@@ -253,11 +253,11 @@ void smp_release_cpus(void) | |||
253 | for (i = 0; i < 100000; i++) { | 253 | for (i = 0; i < 100000; i++) { |
254 | mb(); | 254 | mb(); |
255 | HMT_low(); | 255 | HMT_low(); |
256 | if (boot_cpu_count == 0) | 256 | if (spinning_secondaries == 0) |
257 | break; | 257 | break; |
258 | udelay(1); | 258 | udelay(1); |
259 | } | 259 | } |
260 | DBG("boot_cpu_count = %d\n", boot_cpu_count); | 260 | DBG("spinning_secondaries = %d\n", spinning_secondaries); |
261 | 261 | ||
262 | DBG(" <- smp_release_cpus()\n"); | 262 | DBG(" <- smp_release_cpus()\n"); |
263 | } | 263 | } |