Re: [PATCH] x86/speculation: Add support for STIBP always-on preferred mode

From: Lendacky, Thomas
Date: Tue Dec 11 2018 - 17:17:40 EST

On 12/11/2018 03:19 PM, Borislav Petkov wrote:
> On Tue, Dec 11, 2018 at 07:19:09PM +0000, Lendacky, Thomas wrote:
>> Alternatively, I can reuse SPECTRE_V2_USER_STRICT and issue pr_info_once()
>> to show that the method has been switched. This would reduce the changes
>> to the code, but then the sysfs information doesn't show the switch (which
>> may be just fine).
> You can still query X86_FEATURE_AMD_STIBP_ALWAYS_ON in stibp_state(),
> no?

If using just SPECTRE_V2_USER_STRICT then the code in stibp_state() would
have to be able differentiate between the case where the mode was switched
because of X86_FEATURE_AMD_STIBP_ALWAYS_ON vs a kernel command line with
"spectre_v2_user=on". I could always set and use a static variable in the
file just for the stibp_state() case.

> But yeah, forcing SPECTRE_V2_USER_STRICT on STIBP_ALWAYS_ON makes sense
> to me, with the already gazillion options we have :-\

I'll give it a bit of time and see if there's any other discussion and
re-submit without the new SPECTRE_V2_USER_STRICT_PREFERRED value.