diff options
Diffstat (limited to 'kernel/cpu.c')
| -rw-r--r-- | kernel/cpu.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 8be22bd80933..fe2b8d0bfe4c 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | /* This protects CPUs going up and down... */ | 18 | /* This protects CPUs going up and down... */ |
| 19 | static DECLARE_MUTEX(cpucontrol); | 19 | static DECLARE_MUTEX(cpucontrol); |
| 20 | 20 | ||
| 21 | static struct notifier_block *cpu_chain; | 21 | static BLOCKING_NOTIFIER_HEAD(cpu_chain); |
| 22 | 22 | ||
| 23 | #ifdef CONFIG_HOTPLUG_CPU | 23 | #ifdef CONFIG_HOTPLUG_CPU |
| 24 | static struct task_struct *lock_cpu_hotplug_owner; | 24 | static struct task_struct *lock_cpu_hotplug_owner; |
| @@ -71,21 +71,13 @@ EXPORT_SYMBOL_GPL(lock_cpu_hotplug_interruptible); | |||
| 71 | /* Need to know about CPUs going up/down? */ | 71 | /* Need to know about CPUs going up/down? */ |
| 72 | int register_cpu_notifier(struct notifier_block *nb) | 72 | int register_cpu_notifier(struct notifier_block *nb) |
| 73 | { | 73 | { |
| 74 | int ret; | 74 | return blocking_notifier_chain_register(&cpu_chain, nb); |
| 75 | |||
| 76 | if ((ret = lock_cpu_hotplug_interruptible()) != 0) | ||
| 77 | return ret; | ||
| 78 | ret = notifier_chain_register(&cpu_chain, nb); | ||
| 79 | unlock_cpu_hotplug(); | ||
| 80 | return ret; | ||
| 81 | } | 75 | } |
| 82 | EXPORT_SYMBOL(register_cpu_notifier); | 76 | EXPORT_SYMBOL(register_cpu_notifier); |
| 83 | 77 | ||
| 84 | void unregister_cpu_notifier(struct notifier_block *nb) | 78 | void unregister_cpu_notifier(struct notifier_block *nb) |
| 85 | { | 79 | { |
| 86 | lock_cpu_hotplug(); | 80 | blocking_notifier_chain_unregister(&cpu_chain, nb); |
| 87 | notifier_chain_unregister(&cpu_chain, nb); | ||
| 88 | unlock_cpu_hotplug(); | ||
| 89 | } | 81 | } |
| 90 | EXPORT_SYMBOL(unregister_cpu_notifier); | 82 | EXPORT_SYMBOL(unregister_cpu_notifier); |
| 91 | 83 | ||
| @@ -141,7 +133,7 @@ int cpu_down(unsigned int cpu) | |||
| 141 | goto out; | 133 | goto out; |
| 142 | } | 134 | } |
| 143 | 135 | ||
| 144 | err = notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, | 136 | err = blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, |
| 145 | (void *)(long)cpu); | 137 | (void *)(long)cpu); |
| 146 | if (err == NOTIFY_BAD) { | 138 | if (err == NOTIFY_BAD) { |
| 147 | printk("%s: attempt to take down CPU %u failed\n", | 139 | printk("%s: attempt to take down CPU %u failed\n", |
| @@ -159,7 +151,7 @@ int cpu_down(unsigned int cpu) | |||
| 159 | p = __stop_machine_run(take_cpu_down, NULL, cpu); | 151 | p = __stop_machine_run(take_cpu_down, NULL, cpu); |
| 160 | if (IS_ERR(p)) { | 152 | if (IS_ERR(p)) { |
| 161 | /* CPU didn't die: tell everyone. Can't complain. */ | 153 | /* CPU didn't die: tell everyone. Can't complain. */ |
| 162 | if (notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, | 154 | if (blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, |
| 163 | (void *)(long)cpu) == NOTIFY_BAD) | 155 | (void *)(long)cpu) == NOTIFY_BAD) |
| 164 | BUG(); | 156 | BUG(); |
| 165 | 157 | ||
| @@ -182,8 +174,8 @@ int cpu_down(unsigned int cpu) | |||
| 182 | put_cpu(); | 174 | put_cpu(); |
| 183 | 175 | ||
| 184 | /* CPU is completely dead: tell everyone. Too late to complain. */ | 176 | /* CPU is completely dead: tell everyone. Too late to complain. */ |
| 185 | if (notifier_call_chain(&cpu_chain, CPU_DEAD, (void *)(long)cpu) | 177 | if (blocking_notifier_call_chain(&cpu_chain, CPU_DEAD, |
| 186 | == NOTIFY_BAD) | 178 | (void *)(long)cpu) == NOTIFY_BAD) |
| 187 | BUG(); | 179 | BUG(); |
| 188 | 180 | ||
| 189 | check_for_tasks(cpu); | 181 | check_for_tasks(cpu); |
| @@ -211,7 +203,7 @@ int __devinit cpu_up(unsigned int cpu) | |||
| 211 | goto out; | 203 | goto out; |
| 212 | } | 204 | } |
| 213 | 205 | ||
| 214 | ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); | 206 | ret = blocking_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); |
| 215 | if (ret == NOTIFY_BAD) { | 207 | if (ret == NOTIFY_BAD) { |
| 216 | printk("%s: attempt to bring up CPU %u failed\n", | 208 | printk("%s: attempt to bring up CPU %u failed\n", |
| 217 | __FUNCTION__, cpu); | 209 | __FUNCTION__, cpu); |
| @@ -226,11 +218,12 @@ int __devinit cpu_up(unsigned int cpu) | |||
| 226 | BUG_ON(!cpu_online(cpu)); | 218 | BUG_ON(!cpu_online(cpu)); |
| 227 | 219 | ||
| 228 | /* Now call notifier in preparation. */ | 220 | /* Now call notifier in preparation. */ |
| 229 | notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu); | 221 | blocking_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu); |
| 230 | 222 | ||
| 231 | out_notify: | 223 | out_notify: |
| 232 | if (ret != 0) | 224 | if (ret != 0) |
| 233 | notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu); | 225 | blocking_notifier_call_chain(&cpu_chain, |
| 226 | CPU_UP_CANCELED, hcpu); | ||
| 234 | out: | 227 | out: |
| 235 | unlock_cpu_hotplug(); | 228 | unlock_cpu_hotplug(); |
| 236 | return ret; | 229 | return ret; |
