microcode: rendezvous CPUs in NMI handler and load ucode
authorSergey Dyasli <sergey.dyasli@citrix.com>
Wed, 2 Oct 2019 11:35:44 +0000 (13:35 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 2 Oct 2019 11:35:44 +0000 (13:35 +0200)
commit5ed12565aa32399e118f5020fa995263eeedb01a
tree5313701a5033e716229b8976df448a3160d0be5d
parent7d5247cee21aa38a16c4b21bc9243eda70c8aebd
microcode: rendezvous CPUs in NMI handler and load ucode

When one core is loading ucode, handling NMI on sibling threads or
on other cores in the system might be problematic. By rendezvousing
all CPUs in NMI handler, it prevents NMI acceptance during ucode
loading.

Basically, some work previously done in stop_machine context is
moved to NMI handler. Primary threads call in and load ucode in
NMI handler. Secondary threads wait for the completion of ucode
loading on all CPU cores. An option is introduced to disable this
behavior.

Control thread doesn't rendezvous in NMI handler by calling self_nmi()
(in case of unknown_nmi_error() being triggered). The side effect is
control thread might be handling an NMI while other threads are loading
ucode. If an ucode is to update something shared by a whole socket,
control thread may be accessing things that are being updating by the
ucode loading on other cores. It is not safe. Update ucode on the
control thread first to mitigate this issue.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
docs/misc/xen-command-line.pandoc
xen/arch/x86/microcode.c
xen/arch/x86/traps.c
xen/include/asm-x86/nmi.h