aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2012-07-23 14:15:10 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2012-08-22 19:14:52 -0400
commit09c3f0d883300c8fc2bb62e9a70cf89a2ada9a80 (patch)
tree28c96ebf149691c2c4b5c3f9328f27cbdd88a4f8
parentbb9d3e473d5b324907e15dff4e54410b28ea50e2 (diff)
x86, microcode: Cleanup cpu hotplug notifier callback
Mask out CPU_TASKS_FROZEN bit so that all _FROZEN cases can be dropped. Also, add some more comments as to why CPU_ONLINE falls through to CPU_DOWN_FAILED (no break), and for the CPU_DEAD case. Realign debug printks better. Idea blatantly stolen from a tglx patch: http://marc.info/?l=linux-kernel&m=134267779513862 Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Link: http://lkml.kernel.org/r/1344361461-10076-5-git-send-email-bp@amd64.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/kernel/microcode_core.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 706a5c9b8eb2..dcde544e012c 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -470,34 +470,41 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
470 struct device *dev; 470 struct device *dev;
471 471
472 dev = get_cpu_device(cpu); 472 dev = get_cpu_device(cpu);
473 switch (action) { 473
474 switch (action & ~CPU_TASKS_FROZEN) {
474 case CPU_ONLINE: 475 case CPU_ONLINE:
475 case CPU_ONLINE_FROZEN:
476 microcode_update_cpu(cpu); 476 microcode_update_cpu(cpu);
477 case CPU_DOWN_FAILED:
478 case CPU_DOWN_FAILED_FROZEN:
479 pr_debug("CPU%d added\n", cpu); 477 pr_debug("CPU%d added\n", cpu);
478 /*
479 * "break" is missing on purpose here because we want to fall
480 * through in order to create the sysfs group.
481 */
482
483 case CPU_DOWN_FAILED:
480 if (sysfs_create_group(&dev->kobj, &mc_attr_group)) 484 if (sysfs_create_group(&dev->kobj, &mc_attr_group))
481 pr_err("Failed to create group for CPU%d\n", cpu); 485 pr_err("Failed to create group for CPU%d\n", cpu);
482 break; 486 break;
487
483 case CPU_DOWN_PREPARE: 488 case CPU_DOWN_PREPARE:
484 case CPU_DOWN_PREPARE_FROZEN:
485 /* Suspend is in progress, only remove the interface */ 489 /* Suspend is in progress, only remove the interface */
486 sysfs_remove_group(&dev->kobj, &mc_attr_group); 490 sysfs_remove_group(&dev->kobj, &mc_attr_group);
487 pr_debug("CPU%d removed\n", cpu); 491 pr_debug("CPU%d removed\n", cpu);
488 break; 492 break;
489 493
490 /* 494 /*
495 * case CPU_DEAD:
496 *
491 * When a CPU goes offline, don't free up or invalidate the copy of 497 * When a CPU goes offline, don't free up or invalidate the copy of
492 * the microcode in kernel memory, so that we can reuse it when the 498 * the microcode in kernel memory, so that we can reuse it when the
493 * CPU comes back online without unnecessarily requesting the userspace 499 * CPU comes back online without unnecessarily requesting the userspace
494 * for it again. 500 * for it again.
495 */ 501 */
496 case CPU_UP_CANCELED_FROZEN:
497 /* The CPU refused to come up during a system resume */
498 microcode_fini_cpu(cpu);
499 break;
500 } 502 }
503
504 /* The CPU refused to come up during a system resume */
505 if (action == CPU_UP_CANCELED_FROZEN)
506 microcode_fini_cpu(cpu);
507
501 return NOTIFY_OK; 508 return NOTIFY_OK;
502} 509}
503 510