projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[POWERPC] 83xx: Add support for MPC8349E-mITX-GP
[powerpc.git]
/
kernel
/
cpu.c
diff --git
a/kernel/cpu.c
b/kernel/cpu.c
index
32c9662
..
3d4206a
100644
(file)
--- a/
kernel/cpu.c
+++ b/
kernel/cpu.c
@@
-19,7
+19,7
@@
static DEFINE_MUTEX(cpu_add_remove_lock);
static DEFINE_MUTEX(cpu_bitmask_lock);
static DEFINE_MUTEX(cpu_add_remove_lock);
static DEFINE_MUTEX(cpu_bitmask_lock);
-static __cpuinitdata
BLOCKING
_NOTIFIER_HEAD(cpu_chain);
+static __cpuinitdata
RAW
_NOTIFIER_HEAD(cpu_chain);
/* If set, cpu_up and cpu_down will return -EBUSY and do nothing.
* Should always be manipulated under cpu_add_remove_lock
/* If set, cpu_up and cpu_down will return -EBUSY and do nothing.
* Should always be manipulated under cpu_add_remove_lock
@@
-58,8
+58,8
@@
void unlock_cpu_hotplug(void)
recursive_depth--;
return;
}
recursive_depth--;
return;
}
- mutex_unlock(&cpu_bitmask_lock);
recursive = NULL;
recursive = NULL;
+ mutex_unlock(&cpu_bitmask_lock);
}
EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
}
EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
@@
-68,7
+68,11
@@
EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
/* Need to know about CPUs going up/down? */
int __cpuinit register_cpu_notifier(struct notifier_block *nb)
{
/* Need to know about CPUs going up/down? */
int __cpuinit register_cpu_notifier(struct notifier_block *nb)
{
- return blocking_notifier_chain_register(&cpu_chain, nb);
+ int ret;
+ mutex_lock(&cpu_add_remove_lock);
+ ret = raw_notifier_chain_register(&cpu_chain, nb);
+ mutex_unlock(&cpu_add_remove_lock);
+ return ret;
}
#ifdef CONFIG_HOTPLUG_CPU
}
#ifdef CONFIG_HOTPLUG_CPU
@@
-77,7
+81,9
@@
EXPORT_SYMBOL(register_cpu_notifier);
void unregister_cpu_notifier(struct notifier_block *nb)
{
void unregister_cpu_notifier(struct notifier_block *nb)
{
- blocking_notifier_chain_unregister(&cpu_chain, nb);
+ mutex_lock(&cpu_add_remove_lock);
+ raw_notifier_chain_unregister(&cpu_chain, nb);
+ mutex_unlock(&cpu_add_remove_lock);
}
EXPORT_SYMBOL(unregister_cpu_notifier);
}
EXPORT_SYMBOL(unregister_cpu_notifier);
@@
-126,7
+132,7
@@
static int _cpu_down(unsigned int cpu)
if (!cpu_online(cpu))
return -EINVAL;
if (!cpu_online(cpu))
return -EINVAL;
- err =
blocking
_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
+ err =
raw
_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
(void *)(long)cpu);
if (err == NOTIFY_BAD) {
printk("%s: attempt to take down CPU %u failed\n",
(void *)(long)cpu);
if (err == NOTIFY_BAD) {
printk("%s: attempt to take down CPU %u failed\n",
@@
-144,18
+150,18
@@
static int _cpu_down(unsigned int cpu)
p = __stop_machine_run(take_cpu_down, NULL, cpu);
mutex_unlock(&cpu_bitmask_lock);
p = __stop_machine_run(take_cpu_down, NULL, cpu);
mutex_unlock(&cpu_bitmask_lock);
- if (IS_ERR(p)) {
+ if (IS_ERR(p)
|| cpu_online(cpu)
) {
/* CPU didn't die: tell everyone. Can't complain. */
/* CPU didn't die: tell everyone. Can't complain. */
- if (
blocking
_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
+ if (
raw
_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
(void *)(long)cpu) == NOTIFY_BAD)
BUG();
(void *)(long)cpu) == NOTIFY_BAD)
BUG();
- err = PTR_ERR(p);
- goto out_allowed;
- }
-
- if (cpu_online(cpu))
+ if (IS_ERR(p)) {
+ err = PTR_ERR(p);
+ goto out_allowed;
+ }
goto out_thread;
goto out_thread;
+ }
/* Wait for it to sleep (leaving idle task). */
while (!idle_cpu(cpu))
/* Wait for it to sleep (leaving idle task). */
while (!idle_cpu(cpu))
@@
-169,7
+175,7
@@
static int _cpu_down(unsigned int cpu)
put_cpu();
/* CPU is completely dead: tell everyone. Too late to complain. */
put_cpu();
/* CPU is completely dead: tell everyone. Too late to complain. */
- if (
blocking
_notifier_call_chain(&cpu_chain, CPU_DEAD,
+ if (
raw
_notifier_call_chain(&cpu_chain, CPU_DEAD,
(void *)(long)cpu) == NOTIFY_BAD)
BUG();
(void *)(long)cpu) == NOTIFY_BAD)
BUG();
@@
-198,7
+204,7
@@
int cpu_down(unsigned int cpu)
#endif /*CONFIG_HOTPLUG_CPU*/
/* Requires cpu_add_remove_lock to be held */
#endif /*CONFIG_HOTPLUG_CPU*/
/* Requires cpu_add_remove_lock to be held */
-static int __
dev
init _cpu_up(unsigned int cpu)
+static int __
cpu
init _cpu_up(unsigned int cpu)
{
int ret;
void *hcpu = (void *)(long)cpu;
{
int ret;
void *hcpu = (void *)(long)cpu;
@@
-206,7
+212,7
@@
static int __devinit _cpu_up(unsigned int cpu)
if (cpu_online(cpu) || !cpu_present(cpu))
return -EINVAL;
if (cpu_online(cpu) || !cpu_present(cpu))
return -EINVAL;
- ret =
blocking
_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
+ ret =
raw
_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
if (ret == NOTIFY_BAD) {
printk("%s: attempt to bring up CPU %u failed\n",
__FUNCTION__, cpu);
if (ret == NOTIFY_BAD) {
printk("%s: attempt to bring up CPU %u failed\n",
__FUNCTION__, cpu);
@@
-223,17
+229,17
@@
static int __devinit _cpu_up(unsigned int cpu)
BUG_ON(!cpu_online(cpu));
/* Now call notifier in preparation. */
BUG_ON(!cpu_online(cpu));
/* Now call notifier in preparation. */
-
blocking
_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);
+
raw
_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);
out_notify:
if (ret != 0)
out_notify:
if (ret != 0)
-
blocking
_notifier_call_chain(&cpu_chain,
+
raw
_notifier_call_chain(&cpu_chain,
CPU_UP_CANCELED, hcpu);
return ret;
}
CPU_UP_CANCELED, hcpu);
return ret;
}
-int __
dev
init cpu_up(unsigned int cpu)
+int __
cpu
init cpu_up(unsigned int cpu)
{
int err = 0;
{
int err = 0;
@@
-252,7
+258,7
@@
static cpumask_t frozen_cpus;
int disable_nonboot_cpus(void)
{
int disable_nonboot_cpus(void)
{
- int cpu, first_cpu, error;
+ int cpu, first_cpu, error
= 0
;
mutex_lock(&cpu_add_remove_lock);
first_cpu = first_cpu(cpu_present_map);
mutex_lock(&cpu_add_remove_lock);
first_cpu = first_cpu(cpu_present_map);
@@
-264,11
+270,7
@@
int disable_nonboot_cpus(void)
goto out;
}
}
goto out;
}
}
- error = set_cpus_allowed(current, cpumask_of_cpu(first_cpu));
- if (error) {
- printk(KERN_ERR "Could not run on CPU%d\n", first_cpu);
- goto out;
- }
+
/* We take down all of the non-boot CPUs in one shot to avoid races
* with the userspace trying to use the CPU hotplug at the same time
*/
/* We take down all of the non-boot CPUs in one shot to avoid races
* with the userspace trying to use the CPU hotplug at the same time
*/
@@
-292,7
+294,7
@@
int disable_nonboot_cpus(void)
/* Make sure the CPUs won't be enabled by someone else */
cpu_hotplug_disabled = 1;
} else {
/* Make sure the CPUs won't be enabled by someone else */
cpu_hotplug_disabled = 1;
} else {
- printk(KERN_ERR "Non-boot CPUs are not disabled");
+ printk(KERN_ERR "Non-boot CPUs are not disabled
\n
");
}
out:
mutex_unlock(&cpu_add_remove_lock);
}
out:
mutex_unlock(&cpu_add_remove_lock);
@@
-307,6
+309,8
@@
void enable_nonboot_cpus(void)
mutex_lock(&cpu_add_remove_lock);
cpu_hotplug_disabled = 0;
mutex_unlock(&cpu_add_remove_lock);
mutex_lock(&cpu_add_remove_lock);
cpu_hotplug_disabled = 0;
mutex_unlock(&cpu_add_remove_lock);
+ if (cpus_empty(frozen_cpus))
+ return;
printk("Enabling non-boot CPUs ...\n");
for_each_cpu_mask(cpu, frozen_cpus) {
printk("Enabling non-boot CPUs ...\n");
for_each_cpu_mask(cpu, frozen_cpus) {