Commit 7ac87abb8166b99584149fcfb2efef5773a078e9

Authored by Matt Evans
Committed by Benjamin Herrenschmidt
1 parent 32d206eb56

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>

Showing 5 changed files with 13 additions and 6 deletions Side-by-side Diff

arch/powerpc/include/asm/smp.h
... ... @@ -30,7 +30,7 @@
30 30 #include <asm/percpu.h>
31 31  
32 32 extern int boot_cpuid;
33   -extern int boot_cpu_count;
  33 +extern int spinning_secondaries;
34 34  
35 35 extern void cpu_die(void);
36 36  
arch/powerpc/kernel/head_64.S
... ... @@ -255,7 +255,7 @@
255 255 mtctr r23
256 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 259 lwarx r4,0,r3
260 260 subi r4,r4,1
261 261 stwcx. r4,0,r3
arch/powerpc/kernel/prom.c
... ... @@ -69,6 +69,7 @@
69 69 u64 ppc64_rma_size;
70 70 #endif
71 71 static phys_addr_t first_memblock_size;
  72 +static int __initdata boot_cpu_count;
72 73  
73 74 static int __init early_parse_mem(char *p)
74 75 {
... ... @@ -747,6 +748,13 @@
747 748 * (altivec support, boot CPU ID, ...)
748 749 */
749 750 of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
  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
750 758  
751 759 DBG(" <- early_init_devtree()\n");
752 760 }
arch/powerpc/kernel/setup_32.c
... ... @@ -48,7 +48,6 @@
48 48  
49 49 int boot_cpuid = -1;
50 50 EXPORT_SYMBOL_GPL(boot_cpuid);
51   -int __initdata boot_cpu_count;
52 51 int boot_cpuid_phys;
53 52  
54 53 int smp_hw_index[NR_CPUS];
arch/powerpc/kernel/setup_64.c
... ... @@ -73,7 +73,7 @@
73 73 #endif
74 74  
75 75 int boot_cpuid = 0;
76   -int __initdata boot_cpu_count;
  76 +int __initdata spinning_secondaries;
77 77 u64 ppc64_pft_size;
78 78  
79 79 /* Pick defaults since we might want to patch instructions
80 80  
... ... @@ -253,11 +253,11 @@
253 253 for (i = 0; i < 100000; i++) {
254 254 mb();
255 255 HMT_low();
256   - if (boot_cpu_count == 0)
  256 + if (spinning_secondaries == 0)
257 257 break;
258 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 262 DBG(" <- smp_release_cpus()\n");
263 263 }