x86/spec-ctrl: Only adjust MSR_SPEC_CTRL for idle with legacy IBRS
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Jul 2022 09:12:46 +0000 (11:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Jul 2022 09:12:46 +0000 (11:12 +0200)
commit09d533f4c80b7eaf9fb4e36ebba8259580857a9d
tree685d3570d094cfa4cfe445f9e62232578b08c607
parent81ee3d08351be1ef2a14d371993604098d6a4673
x86/spec-ctrl: Only adjust MSR_SPEC_CTRL for idle with legacy IBRS

Back at the time of the original Spectre-v2 fixes, it was recommended to clear
MSR_SPEC_CTRL when going idle.  This is because of the side effects on the
sibling thread caused by the microcode IBRS and STIBP implementations which
were retrofitted to existing CPUs.

However, there are no relevant cross-thread impacts for the hardware
IBRS/STIBP implementations, so this logic should not be used on Intel CPUs
supporting eIBRS, or any AMD CPUs; doing so only adds unnecessary latency to
the idle path.

Furthermore, there's no point playing with MSR_SPEC_CTRL in the idle paths if
SMT is disabled for other reasons.

Fixes: 8d03080d2a33 ("x86/spec-ctrl: Cease using thunk=lfence on AMD")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: ffc7694e0c99eea158c32aa164b7d1e1bb1dc46b
master date: 2022-06-30 18:07:13 +0100
xen/arch/x86/spec_ctrl.c
xen/include/asm-x86/cpufeatures.h
xen/include/asm-x86/spec_ctrl.h