x86/smpboot: Unbreak CPU0 hotplug
authorVitaly Kuznetsov <vkuznets@redhat.com>
Thu, 3 Aug 2017 10:58:18 +0000 (12:58 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 10 Aug 2017 15:02:47 +0000 (17:02 +0200)
commit10e66760fa8ee11f254a69433fc132d04758a5fc
tree5feb4401244f2371d3f46a9ac752a211da1f6455
parente93c17301ac55321fc18e0f8316e924e58a83c8c
x86/smpboot: Unbreak CPU0 hotplug

A hang on CPU0 onlining after a preceding offlining is observed. Trace
shows that CPU0 is stuck in check_tsc_sync_target() waiting for source
CPU to run check_tsc_sync_source() but this never happens. Source CPU,
in its turn, is stuck on synchronize_sched() which is called from
native_cpu_up() -> do_boot_cpu() -> unregister_nmi_handler().

So it's a classic ABBA deadlock, due to the use of synchronize_sched() in
unregister_nmi_handler().

Fix the bug by moving unregister_nmi_handler() from do_boot_cpu() to
native_cpu_up() after cpu onlining is done.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170803105818.9934-1-vkuznets@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/smpboot.c