Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1486817
| Path | csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
| Newsgroups | linux.kernel |
| Subject | [tip:smp/hotplug] x86/microcode: Convert to hotplug state machine |
| Date | Mon, 19 Sep 2016 22:00:02 +0200 |
| Message-ID | <sjcTo-1ej-39@gated-at.bofh.it> (permalink) |
| References | <seOcW-2cL-31@gated-at.bofh.it> |
| Reply-To | peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, bp@alien8.de |
| Git-Commit-ID | 29bd7fbc071598e939526f782293dbe137be3768 |
| X-Mailer | tip-git-log-daemon |
| Robot-ID | <tip-bot.git.kernel.org> |
| Robot-Unsubscribe | Contact <mailto:hpa@kernel.org> to get blacklisted from these emails |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 8bit |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Disposition | inline |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 111 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | peterz@infradead.org, linux-kernel@vger.kernel.org, bp@alien8.de, bigeasy@linutronix.de, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de |
| X-Original-Date | Mon, 19 Sep 2016 12:54:13 -0700 |
| X-Original-Message-ID | <tip-29bd7fbc071598e939526f782293dbe137be3768@git.kernel.org> |
| X-Original-References | <20160907164523.46a2xnffha4bv63g@linutronix.de> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1486817 |
Show key headers only | View raw
Commit-ID: 29bd7fbc071598e939526f782293dbe137be3768
Gitweb: http://git.kernel.org/tip/29bd7fbc071598e939526f782293dbe137be3768
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Wed, 7 Sep 2016 18:45:23 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 19 Sep 2016 21:44:27 +0200
x86/microcode: Convert to hotplug state machine
Install the callbacks via the state machine.
CPU_UP_CANCELED_FROZEN() is not preserved: It is only there to free memory in an
error case because it is assumed if the CPU does show up on resume it won't be
seen ever again. As per Borislav:
|IOW, you don't need mc_cpu_dead().
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160907164523.46a2xnffha4bv63g@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/cpu/microcode/core.c | 52 ++++++++++++------------------------
1 file changed, 17 insertions(+), 35 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index df04b2d..5ce5155 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -558,55 +558,36 @@ static struct syscore_ops mc_syscore_ops = {
.resume = mc_bp_resume,
};
-static int
-mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
+static int mc_cpu_online(unsigned int cpu)
{
- unsigned int cpu = (unsigned long)hcpu;
struct device *dev;
dev = get_cpu_device(cpu);
+ microcode_update_cpu(cpu);
+ pr_debug("CPU%d added\n", cpu);
- switch (action & ~CPU_TASKS_FROZEN) {
- case CPU_ONLINE:
- microcode_update_cpu(cpu);
- 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;
+ if (sysfs_create_group(&dev->kobj, &mc_attr_group))
+ pr_err("Failed to create group for CPU%d\n", cpu);
+ return 0;
+}
- case CPU_DOWN_PREPARE:
- /* Suspend is in progress, only remove the interface */
- sysfs_remove_group(&dev->kobj, &mc_attr_group);
- pr_debug("CPU%d removed\n", cpu);
- break;
+static int mc_cpu_down_prep(unsigned int cpu)
+{
+ struct device *dev;
+ dev = get_cpu_device(cpu);
+ /* Suspend is in progress, only remove the interface */
+ sysfs_remove_group(&dev->kobj, &mc_attr_group);
+ pr_debug("CPU%d removed\n", cpu);
/*
- * 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.
*/
- }
-
- /* The CPU refused to come up during a system resume */
- if (action == CPU_UP_CANCELED_FROZEN)
- microcode_fini_cpu(cpu);
-
- return NOTIFY_OK;
+ return 0;
}
-static struct notifier_block mc_cpu_notifier = {
- .notifier_call = mc_cpu_callback,
-};
-
static struct attribute *cpu_root_microcode_attrs[] = {
&dev_attr_reload.attr,
NULL
@@ -665,7 +646,8 @@ int __init microcode_init(void)
goto out_ucode_group;
register_syscore_ops(&mc_syscore_ops);
- register_hotcpu_notifier(&mc_cpu_notifier);
+ cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "x86/microcode:online",
+ mc_cpu_online, mc_cpu_down_prep);
pr_info("Microcode Update Driver: v" MICROCODE_VERSION
" <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n");
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[tip:smp/hotplug] x86/microcode: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-09-19 22:00 +0200
csiph-web