fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / x86_64 / kernel / smp-xen.c
index 1b9fad1..323c142 100644 (file)
@@ -76,7 +76,7 @@ static DEFINE_PER_CPU(union smp_flush_state, flush_state);
  * We cannot call mmdrop() because we are in interrupt context, 
  * instead update mm->cpu_vm_mask.
  */
-static inline void leave_mm(unsigned long cpu)
+static inline void leave_mm(int cpu)
 {
        if (read_pda(mmu_state) == TLBSTATE_OK)
                BUG();
@@ -209,7 +209,7 @@ int __cpuinit init_smp_flush(void)
 {
        int i;
        for_each_cpu_mask(i, cpu_possible_map) {
-               spin_lock_init(&per_cpu(flush_state.tlbstate_lock, i));
+               spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock);
        }
        return 0;
 }
@@ -230,6 +230,7 @@ void flush_tlb_current_task(void)
                flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
        preempt_enable();
 }
+EXPORT_SYMBOL(flush_tlb_current_task);
 
 void flush_tlb_mm (struct mm_struct * mm)
 {
@@ -250,6 +251,7 @@ void flush_tlb_mm (struct mm_struct * mm)
 
        preempt_enable();
 }
+EXPORT_SYMBOL(flush_tlb_mm);
 
 void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
 {
@@ -272,6 +274,7 @@ void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
 
        preempt_enable();
 }
+EXPORT_SYMBOL(flush_tlb_page);
 
 static void do_flush_tlb_all(void* info)
 {
@@ -391,16 +394,20 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
        /* prevent preemption and reschedule on another processor */
        int me = get_cpu();
        if (cpu == me) {
-               WARN_ON(1);
                put_cpu();
-               return -EBUSY;
+               return 0;
        }
+
+       /* Can deadlock when called with interrupts disabled */
+       WARN_ON(irqs_disabled());
+
        spin_lock_bh(&call_lock);
        __smp_call_function_single(cpu, func, info, nonatomic, wait);
        spin_unlock_bh(&call_lock);
        put_cpu();
        return 0;
 }
+EXPORT_SYMBOL(smp_call_function_single);
 
 /*
  * this function sends a 'generic call function' IPI to all other CPUs
@@ -469,6 +476,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
        spin_unlock(&call_lock);
        return 0;
 }
+EXPORT_SYMBOL(smp_call_function);
 
 void smp_stop_cpu(void)
 {
@@ -481,7 +489,7 @@ void smp_stop_cpu(void)
 #ifndef CONFIG_XEN
        disable_local_APIC();
 #endif
-       local_irq_restore(flags); 
+       local_irq_restore(flags);
 }
 
 static void smp_really_stop_cpu(void *dummy)
@@ -500,7 +508,7 @@ void smp_send_stop(void)
 #endif
        /* Don't deadlock on the call lock in panic */
        if (!spin_trylock(&call_lock)) {
-               /* ignore locking because we have paniced anyways */
+               /* ignore locking because we have panicked anyways */
                nolock = 1;
        }
        __smp_call_function(smp_really_stop_cpu, NULL, 0, 0);
@@ -566,31 +574,3 @@ asmlinkage irqreturn_t smp_call_function_interrupt(void)
        return IRQ_HANDLED;
 #endif
 }
-
-int safe_smp_processor_id(void)
-{
-#ifdef CONFIG_XEN
-       return smp_processor_id();
-#else
-       int apicid, i;
-
-       if (disable_apic)
-               return 0;
-
-       apicid = hard_smp_processor_id();
-       if (x86_cpu_to_apicid[apicid] == apicid)
-               return apicid;
-
-       for (i = 0; i < NR_CPUS; ++i) {
-               if (x86_cpu_to_apicid[i] == apicid)
-                       return i;
-       }
-
-       /* No entries in x86_cpu_to_apicid?  Either no MPS|ACPI,
-        * or called too early.  Either way, we must be CPU 0. */
-       if (x86_cpu_to_apicid[0] == BAD_APICID)
-               return 0;
-
-       return 0; /* Should not happen */
-#endif
-}