提交 0e285d36 编写于 作者: S Sebastian Andrzej Siewior 提交者: Thomas Gleixner

x86/mcheck: Move CPU_DEAD to hotplug state machine

This moves the last piece of the old hotplug notifier code in MCE to the
new hotplug state machine.
Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: NBorislav Petkov <bp@alien8.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: rt@linutronix.de
Cc: linux-edac@vger.kernel.org
Link: http://lkml.kernel.org/r/20161110174447.11848-8-bigeasy@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 8c0eeac8
...@@ -2506,26 +2506,14 @@ static void mce_reenable_cpu(void) ...@@ -2506,26 +2506,14 @@ static void mce_reenable_cpu(void)
} }
} }
/* Get notified when a cpu comes on/off. Be hotplug friendly. */ static int mce_cpu_dead(unsigned int cpu)
static int
mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; mce_intel_hcpu_update(cpu);
switch (action & ~CPU_TASKS_FROZEN) { /* intentionally ignoring frozen here */
case CPU_DEAD: if (!cpuhp_tasks_frozen)
mce_intel_hcpu_update(cpu); cmci_rediscover();
return 0;
/* intentionally ignoring frozen here */
if (!(action & CPU_TASKS_FROZEN))
cmci_rediscover();
break;
case CPU_DOWN_PREPARE:
break;
}
return NOTIFY_OK;
} }
static int mce_cpu_online(unsigned int cpu) static int mce_cpu_online(unsigned int cpu)
...@@ -2556,10 +2544,6 @@ static int mce_cpu_pre_down(unsigned int cpu) ...@@ -2556,10 +2544,6 @@ static int mce_cpu_pre_down(unsigned int cpu)
return 0; return 0;
} }
static struct notifier_block mce_cpu_notifier = {
.notifier_call = mce_cpu_callback,
};
static __init void mce_init_banks(void) static __init void mce_init_banks(void)
{ {
int i; int i;
...@@ -2599,16 +2583,17 @@ static __init int mcheck_init_device(void) ...@@ -2599,16 +2583,17 @@ static __init int mcheck_init_device(void)
if (err) if (err)
goto err_out_mem; goto err_out_mem;
err = cpuhp_setup_state(CPUHP_X86_MCE_DEAD, "x86/mce:dead", NULL,
mce_cpu_dead);
if (err)
goto err_out_mem;
err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/mce:online", err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/mce:online",
mce_cpu_online, mce_cpu_pre_down); mce_cpu_online, mce_cpu_pre_down);
if (err < 0) if (err < 0)
goto err_out_mem; goto err_out_online;
hp_online = err; hp_online = err;
cpu_notifier_register_begin();
__register_hotcpu_notifier(&mce_cpu_notifier);
cpu_notifier_register_done();
register_syscore_ops(&mce_syscore_ops); register_syscore_ops(&mce_syscore_ops);
/* register character device /dev/mcelog */ /* register character device /dev/mcelog */
...@@ -2622,6 +2607,9 @@ static __init int mcheck_init_device(void) ...@@ -2622,6 +2607,9 @@ static __init int mcheck_init_device(void)
unregister_syscore_ops(&mce_syscore_ops); unregister_syscore_ops(&mce_syscore_ops);
cpuhp_remove_state(hp_online); cpuhp_remove_state(hp_online);
err_out_online:
cpuhp_remove_state(CPUHP_X86_MCE_DEAD);
err_out_mem: err_out_mem:
free_cpumask_var(mce_device_initialized); free_cpumask_var(mce_device_initialized);
......
...@@ -16,6 +16,7 @@ enum cpuhp_state { ...@@ -16,6 +16,7 @@ enum cpuhp_state {
CPUHP_PERF_SUPERH, CPUHP_PERF_SUPERH,
CPUHP_X86_HPET_DEAD, CPUHP_X86_HPET_DEAD,
CPUHP_X86_APB_DEAD, CPUHP_X86_APB_DEAD,
CPUHP_X86_MCE_DEAD,
CPUHP_VIRT_NET_DEAD, CPUHP_VIRT_NET_DEAD,
CPUHP_SLUB_DEAD, CPUHP_SLUB_DEAD,
CPUHP_MM_WRITEBACK_DEAD, CPUHP_MM_WRITEBACK_DEAD,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册