From b9364032eb2a398e56db4b4dbc6783de99193e4d Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Mon, 23 Jul 2012 20:15:10 +0200 Subject: [PATCH] --- yaml --- r: 324035 b: refs/heads/master c: 09c3f0d883300c8fc2bb62e9a70cf89a2ada9a80 h: refs/heads/master i: 324033: fd5f2e4a7c200d6513e05023a69b2ef7f48efd0e 324031: 5c85cd9b3fede432367f7251f67739c5b2a836a4 v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/microcode_core.c | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index d43bc848a04f..dac4415df528 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bb9d3e473d5b324907e15dff4e54410b28ea50e2 +refs/heads/master: 09c3f0d883300c8fc2bb62e9a70cf89a2ada9a80 diff --git a/trunk/arch/x86/kernel/microcode_core.c b/trunk/arch/x86/kernel/microcode_core.c index 706a5c9b8eb2..dcde544e012c 100644 --- a/trunk/arch/x86/kernel/microcode_core.c +++ b/trunk/arch/x86/kernel/microcode_core.c @@ -470,34 +470,41 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) struct device *dev; dev = get_cpu_device(cpu); - switch (action) { + + switch (action & ~CPU_TASKS_FROZEN) { case CPU_ONLINE: - case CPU_ONLINE_FROZEN: microcode_update_cpu(cpu); - case CPU_DOWN_FAILED: - case CPU_DOWN_FAILED_FROZEN: pr_debug("CPU%d added\n", cpu); + /* + * "break" is missing on purpose here because we want to fall + * through in order to create the sysfs group. + */ + + case CPU_DOWN_FAILED: if (sysfs_create_group(&dev->kobj, &mc_attr_group)) pr_err("Failed to create group for CPU%d\n", cpu); break; + case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: /* Suspend is in progress, only remove the interface */ sysfs_remove_group(&dev->kobj, &mc_attr_group); pr_debug("CPU%d removed\n", cpu); break; /* + * case CPU_DEAD: + * * When a CPU goes offline, don't free up or invalidate the copy of * the microcode in kernel memory, so that we can reuse it when the * CPU comes back online without unnecessarily requesting the userspace * for it again. */ - case CPU_UP_CANCELED_FROZEN: - /* The CPU refused to come up during a system resume */ - microcode_fini_cpu(cpu); - break; } + + /* The CPU refused to come up during a system resume */ + if (action == CPU_UP_CANCELED_FROZEN) + microcode_fini_cpu(cpu); + return NOTIFY_OK; }