]> xenbits.xensource.com Git - xen.git/commit
x86/spec-ctrl: Only adjust MSR_SPEC_CTRL for idle with legacy IBRS
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 27 Jun 2022 10:54:27 +0000 (11:54 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 30 Jun 2022 17:07:13 +0000 (18:07 +0100)
commitffc7694e0c99eea158c32aa164b7d1e1bb1dc46b
tree51090c33f771a1302ac6723eeaebe47bf26311e9
parent93aa071f66b78a2abbf134aeb96b02f066e6091d
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>
xen/arch/x86/include/asm/cpufeatures.h
xen/arch/x86/include/asm/spec_ctrl.h
xen/arch/x86/spec_ctrl.c