Commit eb0474544bc16a9dab53b26abd846e86ba814eb1

Authored by Thomas Gleinxer
Committed by Russell King
1 parent 6c5482d53f

ARM: 7133/1: SMP: fix per cpu timer setup before the cpu is marked online

The problem is related to the early enabling of interrupts and the
per cpu timer setup before the cpu is marked online. This doesn't
need to be done in order to call calibrate_delay().

calibrate_delay() monitors jiffies, which are updated from the CPU
which is waiting for the new CPU to set the online bit.

So simply calibrate_delay() can be called on the new CPU just from
the interrupt disabled region and move the local timer setup after
stored the cpu data and before enabling interrupts.

This solves both the cpu_online vs. cpu_active problem and the
affinity setting of the per cpu timers.

Signed-off-by: Thomas Gleinxer <tglx@linutronix.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Showing 1 changed file with 13 additions and 10 deletions Side-by-side Diff

arch/arm/kernel/smp.c
... ... @@ -301,18 +301,8 @@
301 301 */
302 302 platform_secondary_init(cpu);
303 303  
304   - /*
305   - * Enable local interrupts.
306   - */
307 304 notify_cpu_starting(cpu);
308   - local_irq_enable();
309   - local_fiq_enable();
310 305  
311   - /*
312   - * Setup the percpu timer for this CPU.
313   - */
314   - percpu_timer_setup();
315   -
316 306 calibrate_delay();
317 307  
318 308 smp_store_cpu_info(cpu);
319 309  
... ... @@ -323,8 +313,21 @@
323 313 * before we continue.
324 314 */
325 315 set_cpu_online(cpu, true);
  316 +
  317 + /*
  318 + * Setup the percpu timer for this CPU.
  319 + */
  320 + percpu_timer_setup();
  321 +
326 322 while (!cpu_active(cpu))
327 323 cpu_relax();
  324 +
  325 + /*
  326 + * cpu_active bit is set, so it's safe to enalbe interrupts
  327 + * now.
  328 + */
  329 + local_irq_enable();
  330 + local_fiq_enable();
328 331  
329 332 /*
330 333 * OK, it's off to the idle thread for us