[ARM] Convert kmalloc+memset to kzalloc
[powerpc.git] / arch / arm / kernel / smp.c
index f5fc57e..02aa300 100644 (file)
@@ -114,7 +114,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
         * We need to tell the secondary core where to find
         * its stack and the page tables.
         */
-       secondary_data.stack = (void *)idle->thread_info + THREAD_START_SP;
+       secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
        secondary_data.pgdir = virt_to_phys(pgd);
        wmb();
 
@@ -184,6 +184,11 @@ int __cpuexit __cpu_disable(void)
         */
        migrate_irqs();
 
+       /*
+        * Stop the local timer for this CPU.
+        */
+       local_timer_stop(cpu);
+
        /*
         * Flush user cache and TLB mappings, and then remove this CPU
         * from the vm mask set of all processes.
@@ -240,7 +245,7 @@ void __cpuexit cpu_die(void)
        __asm__("mov    sp, %0\n"
        "       b       secondary_start_kernel"
                :
-               : "r" ((void *)current->thread_info + THREAD_SIZE - 8));
+               : "r" (task_stack_page(current) + THREAD_SIZE - 8));
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
@@ -268,6 +273,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
        local_flush_tlb_all();
 
        cpu_init();
+       preempt_disable();
 
        /*
         * Give the platform a chance to do its own initialisation.
@@ -289,6 +295,11 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
         */
        cpu_set(cpu, cpu_online_map);
 
+       /*
+        * Setup local timer for this CPU.
+        */
+       local_timer_setup(cpu);
+
        /*
         * OK, it's off to the idle thread for us
         */
@@ -327,7 +338,6 @@ void __init smp_prepare_boot_cpu(void)
 
        per_cpu(cpu_data, cpu).idle = current;
 
-       cpu_set(cpu, cpu_possible_map);
        cpu_set(cpu, cpu_present_map);
        cpu_set(cpu, cpu_online_map);
 }
@@ -454,6 +464,18 @@ void show_ipi_list(struct seq_file *p)
        seq_putc(p, '\n');
 }
 
+void show_local_irqs(struct seq_file *p)
+{
+       unsigned int cpu;
+
+       seq_printf(p, "LOC: ");
+
+       for_each_present_cpu(cpu)
+               seq_printf(p, "%10u ", irq_stat[cpu].local_timer_irqs);
+
+       seq_putc(p, '\n');
+}
+
 static void ipi_timer(struct pt_regs *regs)
 {
        int user = user_mode(regs);
@@ -464,6 +486,18 @@ static void ipi_timer(struct pt_regs *regs)
        irq_exit();
 }
 
+#ifdef CONFIG_LOCAL_TIMERS
+asmlinkage void do_local_timer(struct pt_regs *regs)
+{
+       int cpu = smp_processor_id();
+
+       if (local_timer_ack()) {
+               irq_stat[cpu].local_timer_irqs++;
+               ipi_timer(regs);
+       }
+}
+#endif
+
 /*
  * ipi_call_function - handle IPI from smp_call_function()
  *