X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fx86_64%2Fkernel%2Fsmp-xen.c;h=323c14215bf3b91f69a6e741eb67b28a1cdf6848;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=e1de0ab6e5928604436341b5c36e939901de9a51;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/arch/x86_64/kernel/smp-xen.c b/arch/x86_64/kernel/smp-xen.c index e1de0ab6e..323c14215 100644 --- a/arch/x86_64/kernel/smp-xen.c +++ b/arch/x86_64/kernel/smp-xen.c @@ -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(); @@ -394,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 @@ -485,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) @@ -570,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 - unsigned apicid, i; - - if (disable_apic) - return 0; - - apicid = hard_smp_processor_id(); - if (apicid < NR_CPUS && 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 -}