diff options
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 42 | ||||
-rw-r--r-- | include/linux/cpuhotplug.h | 1 |
2 files changed, 16 insertions, 27 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 78955f501ff2..b888e2f6af41 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -2506,26 +2506,14 @@ static void mce_reenable_cpu(void) | |||
2506 | } | 2506 | } |
2507 | } | 2507 | } |
2508 | 2508 | ||
2509 | /* Get notified when a cpu comes on/off. Be hotplug friendly. */ | 2509 | static int mce_cpu_dead(unsigned int cpu) |
2510 | static int | ||
2511 | mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | ||
2512 | { | 2510 | { |
2513 | unsigned int cpu = (unsigned long)hcpu; | 2511 | mce_intel_hcpu_update(cpu); |
2514 | 2512 | ||
2515 | switch (action & ~CPU_TASKS_FROZEN) { | 2513 | /* intentionally ignoring frozen here */ |
2516 | case CPU_DEAD: | 2514 | if (!cpuhp_tasks_frozen) |
2517 | mce_intel_hcpu_update(cpu); | 2515 | cmci_rediscover(); |
2518 | 2516 | return 0; | |
2519 | /* intentionally ignoring frozen here */ | ||
2520 | if (!(action & CPU_TASKS_FROZEN)) | ||
2521 | cmci_rediscover(); | ||
2522 | break; | ||
2523 | case CPU_DOWN_PREPARE: | ||
2524 | |||
2525 | break; | ||
2526 | } | ||
2527 | |||
2528 | return NOTIFY_OK; | ||
2529 | } | 2517 | } |
2530 | 2518 | ||
2531 | static int mce_cpu_online(unsigned int cpu) | 2519 | static int mce_cpu_online(unsigned int cpu) |
@@ -2556,10 +2544,6 @@ static int mce_cpu_pre_down(unsigned int cpu) | |||
2556 | return 0; | 2544 | return 0; |
2557 | } | 2545 | } |
2558 | 2546 | ||
2559 | static struct notifier_block mce_cpu_notifier = { | ||
2560 | .notifier_call = mce_cpu_callback, | ||
2561 | }; | ||
2562 | |||
2563 | static __init void mce_init_banks(void) | 2547 | static __init void mce_init_banks(void) |
2564 | { | 2548 | { |
2565 | int i; | 2549 | int i; |
@@ -2599,16 +2583,17 @@ static __init int mcheck_init_device(void) | |||
2599 | if (err) | 2583 | if (err) |
2600 | goto err_out_mem; | 2584 | goto err_out_mem; |
2601 | 2585 | ||
2586 | err = cpuhp_setup_state(CPUHP_X86_MCE_DEAD, "x86/mce:dead", NULL, | ||
2587 | mce_cpu_dead); | ||
2588 | if (err) | ||
2589 | goto err_out_mem; | ||
2590 | |||
2602 | err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/mce:online", | 2591 | err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/mce:online", |
2603 | mce_cpu_online, mce_cpu_pre_down); | 2592 | mce_cpu_online, mce_cpu_pre_down); |
2604 | if (err < 0) | 2593 | if (err < 0) |
2605 | goto err_out_mem; | 2594 | goto err_out_online; |
2606 | hp_online = err; | 2595 | hp_online = err; |
2607 | 2596 | ||
2608 | cpu_notifier_register_begin(); | ||
2609 | __register_hotcpu_notifier(&mce_cpu_notifier); | ||
2610 | cpu_notifier_register_done(); | ||
2611 | |||
2612 | register_syscore_ops(&mce_syscore_ops); | 2597 | register_syscore_ops(&mce_syscore_ops); |
2613 | 2598 | ||
2614 | /* register character device /dev/mcelog */ | 2599 | /* register character device /dev/mcelog */ |
@@ -2622,6 +2607,9 @@ err_register: | |||
2622 | unregister_syscore_ops(&mce_syscore_ops); | 2607 | unregister_syscore_ops(&mce_syscore_ops); |
2623 | cpuhp_remove_state(hp_online); | 2608 | cpuhp_remove_state(hp_online); |
2624 | 2609 | ||
2610 | err_out_online: | ||
2611 | cpuhp_remove_state(CPUHP_X86_MCE_DEAD); | ||
2612 | |||
2625 | err_out_mem: | 2613 | err_out_mem: |
2626 | free_cpumask_var(mce_device_initialized); | 2614 | free_cpumask_var(mce_device_initialized); |
2627 | 2615 | ||
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 3410d83cc2e2..79b96f647d64 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -16,6 +16,7 @@ enum cpuhp_state { | |||
16 | CPUHP_PERF_SUPERH, | 16 | CPUHP_PERF_SUPERH, |
17 | CPUHP_X86_HPET_DEAD, | 17 | CPUHP_X86_HPET_DEAD, |
18 | CPUHP_X86_APB_DEAD, | 18 | CPUHP_X86_APB_DEAD, |
19 | CPUHP_X86_MCE_DEAD, | ||
19 | CPUHP_VIRT_NET_DEAD, | 20 | CPUHP_VIRT_NET_DEAD, |
20 | CPUHP_SLUB_DEAD, | 21 | CPUHP_SLUB_DEAD, |
21 | CPUHP_MM_WRITEBACK_DEAD, | 22 | CPUHP_MM_WRITEBACK_DEAD, |