Have smp_call_function_single() return invalid CPU indicies and return
-ENXIO. This function is already executed inside a
get_cpu()..put_cpu() which locks out CPU removal, so rather than
having the higher layers doing another layer of locking to guard
against unplugged CPUs do the test here.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
{
struct call_single_data d;
unsigned long flags;
{
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 */
/* Can deadlock when called with interrupts disabled */
WARN_ON(irqs_disabled());
/* Can deadlock when called with interrupts disabled */
WARN_ON(irqs_disabled());
local_irq_save(flags);
func(info);
local_irq_restore(flags);
local_irq_save(flags);
func(info);
local_irq_restore(flags);
+ } else if ((unsigned)cpu < NR_CPUS && cpu_online(cpu)) {
struct call_single_data *data = NULL;
if (!wait) {
struct call_single_data *data = NULL;
if (!wait) {
data->func = func;
data->info = info;
generic_exec_single(cpu, data);
data->func = func;
data->info = info;
generic_exec_single(cpu, data);
+ } else {
+ err = -ENXIO; /* CPU not online */
}
EXPORT_SYMBOL(smp_call_function_single);
}
EXPORT_SYMBOL(smp_call_function_single);