xen: make sure stop_machine_run() is always called in a tasklet
authorJuergen Gross <jgross@suse.com>
Fri, 28 Feb 2020 17:13:48 +0000 (18:13 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 2 Mar 2020 13:08:04 +0000 (13:08 +0000)
commit188f479de4b77e5493a7df258974a0a9d119fb0c
tree94cc6a389adc44219f38ae9aa6f42b39501072b5
parent9cedfab5e4b50bd1c6276413766350e2bff33b26
xen: make sure stop_machine_run() is always called in a tasklet

With core scheduling active it is mandatory for stop_machine_run() to
be called in idle context only (so either during boot or in a tasklet),
as otherwise a scheduling deadlock would occur: stop_machine_run()
does a cpu rendezvous by activating a tasklet on all other cpus. In
case stop_machine_run() was not called in an idle vcpu it would block
scheduling the idle vcpu on its siblings with core scheduling being
active, resulting in a hang.

Put a BUG_ON() into stop_machine_run() to test for being called in an
idle vcpu only and adapt the missing call site (ucode loading) to use a
tasklet for calling stop_machine_run().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/microcode.c
xen/common/rcupdate.c
xen/common/stop_machine.c