Skip to content

Commit 51cbe7e

Browse files
committed
x86, MCE: Robustify mcheck_init_device
BorisO reports that misc_register() fails often on xen. The current code unregisters the CPU hotplug notifier in that case. If then a CPU is offlined and onlined back again, we end up with a second timer running on that CPU, leading to soft lockups and system hangs. So let's leave the hotcpu notifier always registered - even if mce_device_create failed for some cores and never unreg it so that we can deal with the timer handling accordingly. Reported-and-Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Link: http://lkml.kernel.org/r/1403274493-1371-1-git-send-email-boris.ostrovsky@oracle.com Signed-off-by: Borislav Petkov <bp@suse.de>
1 parent 9a3c414 commit 51cbe7e

File tree

1 file changed

+6
-4
lines changed
  • arch/x86/kernel/cpu/mcheck

1 file changed

+6
-4
lines changed

arch/x86/kernel/cpu/mcheck/mce.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,12 @@ static __init int mcheck_init_device(void)
24512451
for_each_online_cpu(i) {
24522452
err = mce_device_create(i);
24532453
if (err) {
2454+
/*
2455+
* Register notifier anyway (and do not unreg it) so
2456+
* that we don't leave undeleted timers, see notifier
2457+
* callback above.
2458+
*/
2459+
__register_hotcpu_notifier(&mce_cpu_notifier);
24542460
cpu_notifier_register_done();
24552461
goto err_device_create;
24562462
}
@@ -2471,10 +2477,6 @@ static __init int mcheck_init_device(void)
24712477
err_register:
24722478
unregister_syscore_ops(&mce_syscore_ops);
24732479

2474-
cpu_notifier_register_begin();
2475-
__unregister_hotcpu_notifier(&mce_cpu_notifier);
2476-
cpu_notifier_register_done();
2477-
24782480
err_device_create:
24792481
/*
24802482
* We didn't keep track of which devices were created above, but

0 commit comments

Comments
 (0)