vserver 1.9.5.x5
[linux-2.6.git] / arch / sparc64 / kernel / smp.c
index abc65dc..474c4ed 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/seq_file.h>
 #include <linux/cache.h>
 #include <linux/jiffies.h>
+#include <linux/profile.h>
 
 #include <asm/head.h>
 #include <asm/ptrace.h>
@@ -31,7 +32,6 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/oplib.h>
-#include <asm/hardirq.h>
 #include <asm/uaccess.h>
 #include <asm/timer.h>
 #include <asm/starfire.h>
@@ -103,15 +103,6 @@ extern void inherit_locked_prom_mappings(int save_p);
 void __init smp_callin(void)
 {
        int cpuid = hard_smp_processor_id();
-       extern int bigkernel;
-       extern unsigned long kern_locked_tte_data;
-
-       if (bigkernel) {
-               prom_dtlb_load(sparc64_highest_locked_tlbent()-1, 
-                       kern_locked_tte_data + 0x400000, KERNBASE + 0x400000);
-               prom_itlb_load(sparc64_highest_locked_tlbent()-1, 
-                       kern_locked_tte_data + 0x400000, KERNBASE + 0x400000);
-       }
 
        inherit_locked_prom_mappings(0);
 
@@ -163,7 +154,7 @@ static unsigned long current_tick_offset;
 #define NUM_ROUNDS     64      /* magic value */
 #define NUM_ITERS      5       /* likewise */
 
-static spinlock_t itc_sync_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(itc_sync_lock);
 static unsigned long go[SLAVE + 1];
 
 #define DEBUG_TICK_SYNC        0
@@ -303,14 +294,7 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu)
        struct task_struct *p;
        int timeout, ret, cpu_node;
 
-       kernel_thread(NULL, NULL, CLONE_IDLETASK);
-
-       p = prev_task(&init_task);
-
-       init_idle(p, cpu);
-
-       unhash_process(p);
-
+       p = fork_idle(cpu);
        callin_flag = 0;
        cpu_new_thread = p->thread_info;
        cpu_set(cpu, cpu_callout_map);
@@ -562,7 +546,7 @@ struct call_data_struct {
        int wait;
 };
 
-static spinlock_t call_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(call_lock);
 static struct call_data_struct *call_data;
 
 extern unsigned long xcall_call_function;
@@ -910,9 +894,8 @@ static unsigned long penguins_are_doing_time;
 
 void smp_capture(void)
 {
-       int result = __atomic_add(1, &smp_capture_depth);
+       int result = atomic_add_ret(1, &smp_capture_depth);
 
-       membar("#StoreStore | #LoadStore");
        if (result == 1) {
                int ncpus = num_online_cpus();
 
@@ -981,8 +964,6 @@ void smp_promstop_others(void)
        smp_cross_call(&xcall_promstop, 0, 0, 0);
 }
 
-extern void sparc64_do_profile(struct pt_regs *regs);
-
 #define prof_multiplier(__cpu)         cpu_data(__cpu).multiplier
 #define prof_counter(__cpu)            cpu_data(__cpu).counter
 
@@ -1008,7 +989,7 @@ void smp_percpu_timer_interrupt(struct pt_regs *regs)
        }
 
        do {
-               sparc64_do_profile(regs);
+               profile_tick(CPU_PROFILING, regs);
                if (!--prof_counter(cpu)) {
                        irq_enter();
 
@@ -1164,7 +1145,7 @@ report:
 }
 
 /* /proc/profile writes can call this, don't __init it please. */
-static spinlock_t prof_setup_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(prof_setup_lock);
 
 int setup_profiling_timer(unsigned int multiplier)
 {