Merge branch 'acpi-hotplug'
* acpi-hotplug: ACPI / memhotplug: Use defined marco METHOD_NAME__STA ACPI / hotplug: Use kobject_init_and_add() instead of _init() and _add() ACPI / hotplug: Don't set kobject parent pointer explicitly ACPI / hotplug: Set kobject name via kobject_add(), not kobject_set_name() hotplug, powerpc, x86: Remove cpu_hotplug_driver_lock() hotplug / x86: Disable ARCH_CPU_PROBE_RELEASE on x86 hotplug / x86: Add hotplug lock to missing places hotplug / x86: Fix online state in cpu0 debug interface
This commit is contained in:
commit
5c2aae8355
|
@ -844,18 +844,6 @@ void __cpu_die(unsigned int cpu)
|
||||||
smp_ops->cpu_die(cpu);
|
smp_ops->cpu_die(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEFINE_MUTEX(powerpc_cpu_hotplug_driver_mutex);
|
|
||||||
|
|
||||||
void cpu_hotplug_driver_lock()
|
|
||||||
{
|
|
||||||
mutex_lock(&powerpc_cpu_hotplug_driver_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cpu_hotplug_driver_unlock()
|
|
||||||
{
|
|
||||||
mutex_unlock(&powerpc_cpu_hotplug_driver_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cpu_die(void)
|
void cpu_die(void)
|
||||||
{
|
{
|
||||||
if (ppc_md.cpu_die)
|
if (ppc_md.cpu_die)
|
||||||
|
|
|
@ -404,46 +404,38 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
|
||||||
unsigned long drc_index;
|
unsigned long drc_index;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
cpu_hotplug_driver_lock();
|
|
||||||
rc = strict_strtoul(buf, 0, &drc_index);
|
rc = strict_strtoul(buf, 0, &drc_index);
|
||||||
if (rc) {
|
if (rc)
|
||||||
rc = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent = of_find_node_by_path("/cpus");
|
parent = of_find_node_by_path("/cpus");
|
||||||
if (!parent) {
|
if (!parent)
|
||||||
rc = -ENODEV;
|
return -ENODEV;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
dn = dlpar_configure_connector(drc_index, parent);
|
dn = dlpar_configure_connector(drc_index, parent);
|
||||||
if (!dn) {
|
if (!dn)
|
||||||
rc = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_node_put(parent);
|
of_node_put(parent);
|
||||||
|
|
||||||
rc = dlpar_acquire_drc(drc_index);
|
rc = dlpar_acquire_drc(drc_index);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dlpar_free_cc_nodes(dn);
|
dlpar_free_cc_nodes(dn);
|
||||||
rc = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dlpar_attach_node(dn);
|
rc = dlpar_attach_node(dn);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dlpar_release_drc(drc_index);
|
dlpar_release_drc(drc_index);
|
||||||
dlpar_free_cc_nodes(dn);
|
dlpar_free_cc_nodes(dn);
|
||||||
goto out;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dlpar_online_cpu(dn);
|
rc = dlpar_online_cpu(dn);
|
||||||
out:
|
if (rc)
|
||||||
cpu_hotplug_driver_unlock();
|
return rc;
|
||||||
|
|
||||||
return rc ? rc : count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dlpar_offline_cpu(struct device_node *dn)
|
static int dlpar_offline_cpu(struct device_node *dn)
|
||||||
|
@ -516,30 +508,27 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_hotplug_driver_lock();
|
|
||||||
rc = dlpar_offline_cpu(dn);
|
rc = dlpar_offline_cpu(dn);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
of_node_put(dn);
|
of_node_put(dn);
|
||||||
rc = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dlpar_release_drc(*drc_index);
|
rc = dlpar_release_drc(*drc_index);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
of_node_put(dn);
|
of_node_put(dn);
|
||||||
goto out;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dlpar_detach_node(dn);
|
rc = dlpar_detach_node(dn);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dlpar_acquire_drc(*drc_index);
|
dlpar_acquire_drc(*drc_index);
|
||||||
goto out;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
of_node_put(dn);
|
of_node_put(dn);
|
||||||
out:
|
|
||||||
cpu_hotplug_driver_unlock();
|
return count;
|
||||||
return rc ? rc : count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init pseries_dlpar_init(void)
|
static int __init pseries_dlpar_init(void)
|
||||||
|
|
|
@ -254,10 +254,6 @@ config ARCH_HWEIGHT_CFLAGS
|
||||||
default "-fcall-saved-ecx -fcall-saved-edx" if X86_32
|
default "-fcall-saved-ecx -fcall-saved-edx" if X86_32
|
||||||
default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64
|
default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64
|
||||||
|
|
||||||
config ARCH_CPU_PROBE_RELEASE
|
|
||||||
def_bool y
|
|
||||||
depends on HOTPLUG_CPU
|
|
||||||
|
|
||||||
config ARCH_SUPPORTS_UPROBES
|
config ARCH_SUPPORTS_UPROBES
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
|
|
|
@ -82,27 +82,6 @@
|
||||||
/* State of each CPU */
|
/* State of each CPU */
|
||||||
DEFINE_PER_CPU(int, cpu_state) = { 0 };
|
DEFINE_PER_CPU(int, cpu_state) = { 0 };
|
||||||
|
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
|
||||||
/*
|
|
||||||
* We need this for trampoline_base protection from concurrent accesses when
|
|
||||||
* off- and onlining cores wildly.
|
|
||||||
*/
|
|
||||||
static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);
|
|
||||||
|
|
||||||
void cpu_hotplug_driver_lock(void)
|
|
||||||
{
|
|
||||||
mutex_lock(&x86_cpu_hotplug_driver_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cpu_hotplug_driver_unlock(void)
|
|
||||||
{
|
|
||||||
mutex_unlock(&x86_cpu_hotplug_driver_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
|
|
||||||
ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Number of siblings per CPU package */
|
/* Number of siblings per CPU package */
|
||||||
int smp_num_siblings = 1;
|
int smp_num_siblings = 1;
|
||||||
EXPORT_SYMBOL(smp_num_siblings);
|
EXPORT_SYMBOL(smp_num_siblings);
|
||||||
|
|
|
@ -65,29 +65,32 @@ int __ref _debug_hotplug_cpu(int cpu, int action)
|
||||||
if (!cpu_is_hotpluggable(cpu))
|
if (!cpu_is_hotpluggable(cpu))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
cpu_hotplug_driver_lock();
|
lock_device_hotplug();
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 0:
|
case 0:
|
||||||
ret = cpu_down(cpu);
|
ret = cpu_down(cpu);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
pr_info("CPU %u is now offline\n", cpu);
|
pr_info("CPU %u is now offline\n", cpu);
|
||||||
|
dev->offline = true;
|
||||||
kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
|
kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
|
||||||
} else
|
} else
|
||||||
pr_debug("Can't offline CPU%d.\n", cpu);
|
pr_debug("Can't offline CPU%d.\n", cpu);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = cpu_up(cpu);
|
ret = cpu_up(cpu);
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
|
dev->offline = false;
|
||||||
kobject_uevent(&dev->kobj, KOBJ_ONLINE);
|
kobject_uevent(&dev->kobj, KOBJ_ONLINE);
|
||||||
else
|
} else {
|
||||||
pr_debug("Can't online CPU%d.\n", cpu);
|
pr_debug("Can't online CPU%d.\n", cpu);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_hotplug_driver_unlock();
|
unlock_device_hotplug();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,8 +152,9 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
||||||
unsigned long long current_status;
|
unsigned long long current_status;
|
||||||
|
|
||||||
/* Get device present/absent information from the _STA */
|
/* Get device present/absent information from the _STA */
|
||||||
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA",
|
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle,
|
||||||
NULL, ¤t_status)))
|
METHOD_NAME__STA, NULL,
|
||||||
|
¤t_status)))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
/*
|
/*
|
||||||
* Check for device status. Device should be
|
* Check for device status. Device should be
|
||||||
|
|
|
@ -762,13 +762,8 @@ void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
|
||||||
if (!hotplug_kobj)
|
if (!hotplug_kobj)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
kobject_init(&hotplug->kobj, &acpi_hotplug_profile_ktype);
|
error = kobject_init_and_add(&hotplug->kobj,
|
||||||
error = kobject_set_name(&hotplug->kobj, "%s", name);
|
&acpi_hotplug_profile_ktype, hotplug_kobj, "%s", name);
|
||||||
if (error)
|
|
||||||
goto err_out;
|
|
||||||
|
|
||||||
hotplug->kobj.parent = hotplug_kobj;
|
|
||||||
error = kobject_add(&hotplug->kobj, hotplug_kobj, NULL);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,11 @@ static int __ref cpu_subsys_online(struct device *dev)
|
||||||
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
||||||
int cpuid = dev->id;
|
int cpuid = dev->id;
|
||||||
int from_nid, to_nid;
|
int from_nid, to_nid;
|
||||||
int ret = -ENODEV;
|
int ret;
|
||||||
|
|
||||||
cpu_hotplug_driver_lock();
|
|
||||||
|
|
||||||
from_nid = cpu_to_node(cpuid);
|
from_nid = cpu_to_node(cpuid);
|
||||||
if (from_nid == NUMA_NO_NODE)
|
if (from_nid == NUMA_NO_NODE)
|
||||||
goto out;
|
return -ENODEV;
|
||||||
|
|
||||||
ret = cpu_up(cpuid);
|
ret = cpu_up(cpuid);
|
||||||
/*
|
/*
|
||||||
|
@ -61,19 +59,12 @@ static int __ref cpu_subsys_online(struct device *dev)
|
||||||
if (from_nid != to_nid)
|
if (from_nid != to_nid)
|
||||||
change_cpu_under_node(cpu, from_nid, to_nid);
|
change_cpu_under_node(cpu, from_nid, to_nid);
|
||||||
|
|
||||||
out:
|
|
||||||
cpu_hotplug_driver_unlock();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpu_subsys_offline(struct device *dev)
|
static int cpu_subsys_offline(struct device *dev)
|
||||||
{
|
{
|
||||||
int ret;
|
return cpu_down(dev->id);
|
||||||
|
|
||||||
cpu_hotplug_driver_lock();
|
|
||||||
ret = cpu_down(dev->id);
|
|
||||||
cpu_hotplug_driver_unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_cpu(struct cpu *cpu)
|
void unregister_cpu(struct cpu *cpu)
|
||||||
|
@ -93,7 +84,17 @@ static ssize_t cpu_probe_store(struct device *dev,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
return arch_cpu_probe(buf, count);
|
ssize_t cnt;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = lock_device_hotplug_sysfs();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
cnt = arch_cpu_probe(buf, count);
|
||||||
|
|
||||||
|
unlock_device_hotplug();
|
||||||
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t cpu_release_store(struct device *dev,
|
static ssize_t cpu_release_store(struct device *dev,
|
||||||
|
@ -101,7 +102,17 @@ static ssize_t cpu_release_store(struct device *dev,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
return arch_cpu_release(buf, count);
|
ssize_t cnt;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = lock_device_hotplug_sysfs();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
cnt = arch_cpu_release(buf, count);
|
||||||
|
|
||||||
|
unlock_device_hotplug();
|
||||||
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
|
static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
|
||||||
|
|
|
@ -185,19 +185,6 @@ extern void cpu_hotplug_enable(void);
|
||||||
void clear_tasks_mm_cpumask(int cpu);
|
void clear_tasks_mm_cpumask(int cpu);
|
||||||
int cpu_down(unsigned int cpu);
|
int cpu_down(unsigned int cpu);
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
|
|
||||||
extern void cpu_hotplug_driver_lock(void);
|
|
||||||
extern void cpu_hotplug_driver_unlock(void);
|
|
||||||
#else
|
|
||||||
static inline void cpu_hotplug_driver_lock(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cpu_hotplug_driver_unlock(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* CONFIG_HOTPLUG_CPU */
|
#else /* CONFIG_HOTPLUG_CPU */
|
||||||
|
|
||||||
static inline void cpu_hotplug_begin(void) {}
|
static inline void cpu_hotplug_begin(void) {}
|
||||||
|
|
Loading…
Reference in a new issue