]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/smp.c
Revert "OMAP3: ack spurious IRQs in get_irqnr_and_base"
[linux-2.6-omap-h63xx.git] / kernel / smp.c
index e6084f6efb4d70210889c9dbb3e6a02931acc784..f362a85537777619d1ef22602042fba351a75e7d 100644 (file)
@@ -135,7 +135,8 @@ void generic_smp_call_function_interrupt(void)
                         */
                        smp_wmb();
                        data->csd.flags &= ~CSD_FLAG_WAIT;
-               } else
+               }
+               if (data->csd.flags & CSD_FLAG_ALLOC)
                        call_rcu(&data->rcu_head, rcu_free_call_data);
        }
        rcu_read_unlock();
@@ -209,8 +210,10 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
 {
        struct call_single_data d;
        unsigned long flags;
-       /* prevent preemption and reschedule on another processor */
+       /* prevent preemption and reschedule on another processor,
+          as well as CPU removal */
        int me = get_cpu();
+       int err = 0;
 
        /* Can deadlock when called with interrupts disabled */
        WARN_ON(irqs_disabled());
@@ -219,7 +222,7 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
                local_irq_save(flags);
                func(info);
                local_irq_restore(flags);
-       } else {
+       } else if ((unsigned)cpu < NR_CPUS && cpu_online(cpu)) {
                struct call_single_data *data = NULL;
 
                if (!wait) {
@@ -235,10 +238,12 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
                data->func = func;
                data->info = info;
                generic_exec_single(cpu, data);
+       } else {
+               err = -ENXIO;   /* CPU not online */
        }
 
        put_cpu();
-       return 0;
+       return err;
 }
 EXPORT_SYMBOL(smp_call_function_single);
 
@@ -289,10 +294,11 @@ static void smp_call_function_mask_quiesce_stack(cpumask_t mask)
 
        data.func = quiesce_dummy;
        data.info = NULL;
-       data.flags = CSD_FLAG_WAIT;
 
-       for_each_cpu_mask(cpu, mask)
+       for_each_cpu_mask(cpu, mask) {
+               data.flags = CSD_FLAG_WAIT;
                generic_exec_single(cpu, &data);
+       }
 }
 
 /**
@@ -371,7 +377,7 @@ int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
        if (wait) {
                csd_flag_wait(&data->csd);
                if (unlikely(slowpath))
-                       smp_call_function_mask_quiesce_stack(allbutself);
+                       smp_call_function_mask_quiesce_stack(mask);
        }
 
        return 0;