On some smp sysfs store attributes get_online_cpus() may block on
cpu_hotplug.lock, but we hold already smp_cpu_state_mutex. Since the
locking order on cpu hotplug via arch_update_cpu_topology is inverse
this might lead to deadlocks.
So make sure locking order is always the same.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
if (val != 0 && val != 1)
return -EINVAL;
if (val != 0 && val != 1)
return -EINVAL;
- mutex_lock(&smp_cpu_state_mutex);
+ mutex_lock(&smp_cpu_state_mutex);
rc = -EBUSY;
if (cpu_online(cpu))
goto out;
rc = -EBUSY;
if (cpu_online(cpu))
goto out;
mutex_unlock(&smp_cpu_state_mutex);
mutex_unlock(&smp_cpu_state_mutex);
return rc ? rc : count;
}
static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
return rc ? rc : count;
}
static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
- mutex_lock(&smp_cpu_state_mutex);
+ mutex_lock(&smp_cpu_state_mutex);
newcpus = cpu_present_map;
rc = smp_rescan_cpus();
if (rc)
newcpus = cpu_present_map;
rc = smp_rescan_cpus();
if (rc)
mutex_unlock(&smp_cpu_state_mutex);
mutex_unlock(&smp_cpu_state_mutex);
if (!cpus_empty(newcpus))
topology_schedule_update();
return rc ? rc : count;
if (!cpus_empty(newcpus))
topology_schedule_update();
return rc ? rc : count;
if (val != 0 && val != 1)
return -EINVAL;
rc = 0;
if (val != 0 && val != 1)
return -EINVAL;
rc = 0;
- mutex_lock(&smp_cpu_state_mutex);
+ mutex_lock(&smp_cpu_state_mutex);
if (cpu_management == val)
goto out;
rc = topology_set_cpu_management(val);
if (!rc)
cpu_management = val;
out:
if (cpu_management == val)
goto out;
rc = topology_set_cpu_management(val);
if (!rc)
cpu_management = val;
out:
mutex_unlock(&smp_cpu_state_mutex);
mutex_unlock(&smp_cpu_state_mutex);
return rc ? rc : count;
}
static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);
return rc ? rc : count;
}
static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);