Both smp_call_function() and __smp_call_function_map() access
cpu_online_map. Both functions run with preemption disabled which
protects for cpus going offline. However new cpus can be added and
therefore the cpu_online_map can change unexpectedly.
So use the call_lock to protect against changes to the cpu_online_map
in start_secondary() and all smp_call_* functions.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
if (wait)
data.finished = CPU_MASK_NONE;
if (wait)
data.finished = CPU_MASK_NONE;
call_data = &data;
for_each_cpu_mask(cpu, map)
call_data = &data;
for_each_cpu_mask(cpu, map)
if (wait)
while (!cpus_equal(map, data.finished))
cpu_relax();
if (wait)
while (!cpus_equal(map, data.finished))
cpu_relax();
- spin_unlock(&call_lock);
out:
if (local) {
local_irq_disable();
out:
if (local) {
local_irq_disable();
map = cpu_online_map;
cpu_clear(smp_processor_id(), map);
__smp_call_function_map(func, info, nonatomic, wait, map);
map = cpu_online_map;
cpu_clear(smp_processor_id(), map);
__smp_call_function_map(func, info, nonatomic, wait, map);
+ spin_unlock(&call_lock);
return 0;
}
EXPORT_SYMBOL(smp_call_function);
return 0;
}
EXPORT_SYMBOL(smp_call_function);
int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
int nonatomic, int wait)
{
int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
int nonatomic, int wait)
{
__smp_call_function_map(func, info, nonatomic, wait,
cpumask_of_cpu(cpu));
__smp_call_function_map(func, info, nonatomic, wait,
cpumask_of_cpu(cpu));
+ spin_unlock(&call_lock);
return 0;
}
EXPORT_SYMBOL(smp_call_function_single);
return 0;
}
EXPORT_SYMBOL(smp_call_function_single);
int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
int wait)
{
int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
int wait)
{
cpu_clear(smp_processor_id(), mask);
__smp_call_function_map(func, info, 0, wait, mask);
cpu_clear(smp_processor_id(), mask);
__smp_call_function_map(func, info, 0, wait, mask);
+ spin_unlock(&call_lock);
return 0;
}
EXPORT_SYMBOL(smp_call_function_mask);
return 0;
}
EXPORT_SYMBOL(smp_call_function_mask);
pfault_init();
/* Mark this cpu as online */
pfault_init();
/* Mark this cpu as online */
cpu_set(smp_processor_id(), cpu_online_map);
cpu_set(smp_processor_id(), cpu_online_map);
+ spin_unlock(&call_lock);
/* Switch on interrupts */
local_irq_enable();
/* Print info about this processor */
/* Switch on interrupts */
local_irq_enable();
/* Print info about this processor */