[S390] smp: disable preemption in smp_call_function/smp_call_function_on
Avoid sprinkling a _lot_ of preempt_disable/preempt_enable pairs. This would be necessary for e.g. the iucv driver. Also this way we are more consistent with other architectures which disable preemption at least for smp_call_function. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
committed by
Martin Schwidefsky
parent
f794c8279d
commit
25864162c1
@@ -94,10 +94,9 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
|
|||||||
int cpu, local = 0;
|
int cpu, local = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Can deadlock when interrupts are disabled or if in wrong context,
|
* Can deadlock when interrupts are disabled or if in wrong context.
|
||||||
* caller must disable preemption
|
|
||||||
*/
|
*/
|
||||||
WARN_ON(irqs_disabled() || in_irq() || preemptible());
|
WARN_ON(irqs_disabled() || in_irq());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for local function call. We have to have the same call order
|
* Check for local function call. We have to have the same call order
|
||||||
@@ -152,17 +151,18 @@ out:
|
|||||||
* Run a function on all other CPUs.
|
* Run a function on all other CPUs.
|
||||||
*
|
*
|
||||||
* You must not call this function with disabled interrupts or from a
|
* You must not call this function with disabled interrupts or from a
|
||||||
* hardware interrupt handler. Must be called with preemption disabled.
|
* hardware interrupt handler. You may call it from a bottom half.
|
||||||
* You may call it from a bottom half.
|
|
||||||
*/
|
*/
|
||||||
int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
|
int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
|
||||||
int wait)
|
int wait)
|
||||||
{
|
{
|
||||||
cpumask_t map;
|
cpumask_t map;
|
||||||
|
|
||||||
|
preempt_disable();
|
||||||
map = cpu_online_map;
|
map = cpu_online_map;
|
||||||
cpu_clear(smp_processor_id(), map);
|
cpu_clear(smp_processor_id(), map);
|
||||||
__smp_call_function_map(func, info, nonatomic, wait, map);
|
__smp_call_function_map(func, info, nonatomic, wait, map);
|
||||||
|
preempt_enable();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(smp_call_function);
|
EXPORT_SYMBOL(smp_call_function);
|
||||||
@@ -178,16 +178,17 @@ EXPORT_SYMBOL(smp_call_function);
|
|||||||
* Run a function on one processor.
|
* Run a function on one processor.
|
||||||
*
|
*
|
||||||
* You must not call this function with disabled interrupts or from a
|
* You must not call this function with disabled interrupts or from a
|
||||||
* hardware interrupt handler. Must be called with preemption disabled.
|
* hardware interrupt handler. You may call it from a bottom half.
|
||||||
* You may call it from a bottom half.
|
|
||||||
*/
|
*/
|
||||||
int smp_call_function_on(void (*func) (void *info), void *info, int nonatomic,
|
int smp_call_function_on(void (*func) (void *info), void *info, int nonatomic,
|
||||||
int wait, int cpu)
|
int wait, int cpu)
|
||||||
{
|
{
|
||||||
cpumask_t map = CPU_MASK_NONE;
|
cpumask_t map = CPU_MASK_NONE;
|
||||||
|
|
||||||
|
preempt_disable();
|
||||||
cpu_set(cpu, map);
|
cpu_set(cpu, map);
|
||||||
__smp_call_function_map(func, info, nonatomic, wait, map);
|
__smp_call_function_map(func, info, nonatomic, wait, map);
|
||||||
|
preempt_enable();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(smp_call_function_on);
|
EXPORT_SYMBOL(smp_call_function_on);
|
||||||
|
Reference in New Issue
Block a user