Commit 6dedcca6 authored by Toshi Kani's avatar Toshi Kani Committed by Rafael J. Wysocki

hotplug, powerpc, x86: Remove cpu_hotplug_driver_lock()

cpu_hotplug_driver_lock() serializes CPU online/offline operations
when ARCH_CPU_PROBE_RELEASE is set.  This lock interface is no longer
necessary with the following reason:

 - lock_device_hotplug() now protects CPU online/offline operations,
   including the probe & release interfaces enabled by
   ARCH_CPU_PROBE_RELEASE.  The use of cpu_hotplug_driver_lock() is
   redundant.
 - cpu_hotplug_driver_lock() is only valid when ARCH_CPU_PROBE_RELEASE
   is defined, which is misleading and is only enabled on powerpc.

This patch removes the cpu_hotplug_driver_lock() interface.  As
a result, ARCH_CPU_PROBE_RELEASE only enables / disables the cpu
probe & release interface as intended.  There is no functional change
in this patch.
Signed-off-by: default avatarToshi Kani <toshi.kani@hp.com>
Reviewed-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 1cad5e9a
...@@ -844,18 +844,6 @@ void __cpu_die(unsigned int cpu) ...@@ -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) ...@@ -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) ...@@ -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)
......
...@@ -66,7 +66,6 @@ int __ref _debug_hotplug_cpu(int cpu, int action) ...@@ -66,7 +66,6 @@ int __ref _debug_hotplug_cpu(int cpu, int action)
return -EINVAL; return -EINVAL;
lock_device_hotplug(); lock_device_hotplug();
cpu_hotplug_driver_lock();
switch (action) { switch (action) {
case 0: case 0:
...@@ -91,7 +90,6 @@ int __ref _debug_hotplug_cpu(int cpu, int action) ...@@ -91,7 +90,6 @@ int __ref _debug_hotplug_cpu(int cpu, int action)
ret = -EINVAL; ret = -EINVAL;
} }
cpu_hotplug_driver_unlock();
unlock_device_hotplug(); unlock_device_hotplug();
return ret; return ret;
......
...@@ -44,13 +44,11 @@ static int __ref cpu_subsys_online(struct device *dev) ...@@ -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) ...@@ -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)
......
...@@ -185,19 +185,6 @@ extern void cpu_hotplug_enable(void); ...@@ -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) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment