smp: convert cpu_hotplug_begin into a blocking lock acquisition
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 26 Feb 2020 09:55:22 +0000 (10:55 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2020 09:55:22 +0000 (10:55 +0100)
commit5b74f5e42884a01646e9ecf12d402ca20d3ddf7a
treea7dafe29aadd46596628160843e4d6f8bfbecc55
parent868a01021c6f429e4f47647edfe2e76b4a9c753d
smp: convert cpu_hotplug_begin into a blocking lock acquisition

Don't allow cpu_hotplug_begin to fail by converting the trylock into a
blocking lock acquisition. Write users of the cpu_add_remove_lock are
limited to CPU plug/unplug operations, and cannot deadlock between
themselves or other users taking the lock in read mode as
cpu_add_remove_lock is always locked with interrupts enabled. There
are also no other locks taken during the plug/unplug operations.

The exclusive lock usage in register_cpu_notifier is also converted
into a blocking lock acquisition, as it was previously not allowed to
fail anyway.

This is meaningful when running Xen in shim mode, since VCPU_{up/down}
hypercalls use cpu hotplug/unplug operations in the background, and
hence failing to take the lock results in VPCU_{up/down} failing with
-EBUSY, which most users are not prepared to handle.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/smpboot.c
xen/common/cpu.c
xen/include/xen/cpu.h