aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-04-02 02:49:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-02 13:06:09 -0400
commit1d64b9cb1dc2a7cd521444e3d908adeccd026356 (patch)
tree31c6c7751b656e74b5ee05159c85154f710e8956 /kernel/cpu.c
parent0c84ce268b69855919b6ac7edc8f11caf21e9c88 (diff)
[PATCH] Fix microcode-related suspend problem
Fix the regression resulting from the recent change of suspend code ordering that causes systems based on Intel x86 CPUs using the microcode driver to hang during the resume. The problem occurs since the microcode driver uses request_firmware() in its CPU hotplug notifier, which is called after tasks has been frozen and hangs. It can be fixed by telling the microcode driver to use the microcode stored in memory during the resume instead of trying to load it from disk. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Adrian Bunk <bunk@stusta.de> Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk> Cc: Pavel Machek <pavel@ucw.cz> Cc: Maxim <maximlevitsky@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3d4206ada5c9..36e70845cfc3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -254,6 +254,12 @@ int __cpuinit cpu_up(unsigned int cpu)
254} 254}
255 255
256#ifdef CONFIG_SUSPEND_SMP 256#ifdef CONFIG_SUSPEND_SMP
257/* Needed to prevent the microcode driver from requesting firmware in its CPU
258 * hotplug notifier during the suspend/resume.
259 */
260int suspend_cpu_hotplug;
261EXPORT_SYMBOL(suspend_cpu_hotplug);
262
257static cpumask_t frozen_cpus; 263static cpumask_t frozen_cpus;
258 264
259int disable_nonboot_cpus(void) 265int disable_nonboot_cpus(void)
@@ -261,16 +267,8 @@ int disable_nonboot_cpus(void)
261 int cpu, first_cpu, error = 0; 267 int cpu, first_cpu, error = 0;
262 268
263 mutex_lock(&cpu_add_remove_lock); 269 mutex_lock(&cpu_add_remove_lock);
264 first_cpu = first_cpu(cpu_present_map); 270 suspend_cpu_hotplug = 1;
265 if (!cpu_online(first_cpu)) { 271 first_cpu = first_cpu(cpu_online_map);
266 error = _cpu_up(first_cpu);
267 if (error) {
268 printk(KERN_ERR "Could not bring CPU%d up.\n",
269 first_cpu);
270 goto out;
271 }
272 }
273
274 /* We take down all of the non-boot CPUs in one shot to avoid races 272 /* We take down all of the non-boot CPUs in one shot to avoid races
275 * with the userspace trying to use the CPU hotplug at the same time 273 * with the userspace trying to use the CPU hotplug at the same time
276 */ 274 */
@@ -296,7 +294,7 @@ int disable_nonboot_cpus(void)
296 } else { 294 } else {
297 printk(KERN_ERR "Non-boot CPUs are not disabled\n"); 295 printk(KERN_ERR "Non-boot CPUs are not disabled\n");
298 } 296 }
299out: 297 suspend_cpu_hotplug = 0;
300 mutex_unlock(&cpu_add_remove_lock); 298 mutex_unlock(&cpu_add_remove_lock);
301 return error; 299 return error;
302} 300}
@@ -308,20 +306,22 @@ void enable_nonboot_cpus(void)
308 /* Allow everyone to use the CPU hotplug again */ 306 /* Allow everyone to use the CPU hotplug again */
309 mutex_lock(&cpu_add_remove_lock); 307 mutex_lock(&cpu_add_remove_lock);
310 cpu_hotplug_disabled = 0; 308 cpu_hotplug_disabled = 0;
311 mutex_unlock(&cpu_add_remove_lock);
312 if (cpus_empty(frozen_cpus)) 309 if (cpus_empty(frozen_cpus))
313 return; 310 goto out;
314 311
312 suspend_cpu_hotplug = 1;
315 printk("Enabling non-boot CPUs ...\n"); 313 printk("Enabling non-boot CPUs ...\n");
316 for_each_cpu_mask(cpu, frozen_cpus) { 314 for_each_cpu_mask(cpu, frozen_cpus) {
317 error = cpu_up(cpu); 315 error = _cpu_up(cpu);
318 if (!error) { 316 if (!error) {
319 printk("CPU%d is up\n", cpu); 317 printk("CPU%d is up\n", cpu);
320 continue; 318 continue;
321 } 319 }
322 printk(KERN_WARNING "Error taking CPU%d up: %d\n", 320 printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
323 cpu, error);
324 } 321 }
325 cpus_clear(frozen_cpus); 322 cpus_clear(frozen_cpus);
323 suspend_cpu_hotplug = 0;
324out:
325 mutex_unlock(&cpu_add_remove_lock);
326} 326}
327#endif 327#endif