linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>
To: Thomas Gleixner <tglx@linutronix.de>, Borislav Petkov <bp@alien8.de>
Cc: "x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jiri Kosina <jkosina@suse.cz>, Ingo Molnar <mingo@redhat.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	David Woodhouse <dwmw@amazon.co.uk>
Subject: Re: [PATCH v2] x86/speculation: Add support for STIBP always-on preferred mode
Date: Wed, 12 Dec 2018 14:03:56 +0000	[thread overview]
Message-ID: <38aca18b-4312-5e03-fdd9-86e47c332e44@amd.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1812111910520.22893@nanos.tec.linutronix.de>

On 12/11/2018 09:37 PM, Thomas Gleixner wrote:
> On Wed, 12 Dec 2018, Borislav Petkov wrote:
>> On Tue, Dec 11, 2018 at 10:46:16PM +0000, Lendacky, Thomas wrote:
>>> +	/*
>>> +	 * At this point, an STIBP mode other than "off" has been set.
>>> +	 * If STIBP support is not being forced, check if STIBP always-on
>>> +	 * is preferred.
>>> +	 */
>>> +	if (mode != SPECTRE_V2_USER_STRICT &&
>>> +	    boot_cpu_has(X86_FEATURE_AMD_STIBP_ALWAYS_ON)) {
>>> +		stibp_always_on = true;
>>> +		mode = SPECTRE_V2_USER_STRICT;
>>> +		pr_info("mitigation: STIBP always-on is preferred\n");
>>> +	}
>>> +
>>>  	/* Initialize Indirect Branch Prediction Barrier */
>>>  	if (boot_cpu_has(X86_FEATURE_IBPB)) {
>>>  		setup_force_cpu_cap(X86_FEATURE_USE_IBPB);
>>> @@ -1088,7 +1102,8 @@ static char *stibp_state(void)
>>>  	case SPECTRE_V2_USER_NONE:
>>>  		return ", STIBP: disabled";
>>>  	case SPECTRE_V2_USER_STRICT:
>>> -		return ", STIBP: forced";
>>> +		return stibp_always_on ? ", STIBP: always-on"
>>> +				       : ", STIBP: forced";
>>
>> I still don't like that separate stibp_always_on variable when we can do
>> all the querying just by using mode and X86_FEATURE_AMD_STIBP_ALWAYS_ON.
> 
> Hmmm. I've not seen the V1 of this (it's not in my inbox) but the v1->v2
> changes contain:

That's strange, you were on the cc: list. Anyway, here's a link to the
first version: https://lkml.org/lkml/2018/12/11/1248

> 
>>> - Removed explicit SPECTRE_V2_USER_STRICT_PREFERRED mode
> 
> Now I really have to ask why?
> 
> Neither the extra variable nor the cpu feature check are pretty. An
> explicit mode is way better in terms of code clarity and you get the proper
> printout via spectre_v2_user_strings.
> 
> Hmm?

That is what the first version did. See if that's in-line with what
you're thinking.

Thanks,
Tom

> 
> 	tglx
> 

  parent reply	other threads:[~2018-12-12 14:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 22:46 [PATCH v2] x86/speculation: Add support for STIBP always-on preferred mode Lendacky, Thomas
2018-12-12  0:05 ` Borislav Petkov
2018-12-12  3:37   ` Thomas Gleixner
2018-12-12  9:59     ` Borislav Petkov
2018-12-12 14:04       ` Lendacky, Thomas
2018-12-12 14:32         ` Boris Petkov
2018-12-12 15:01           ` Lendacky, Thomas
2018-12-12 14:03     ` Lendacky, Thomas [this message]
2018-12-12 14:23       ` Thomas Gleixner
2018-12-12 15:04         ` Lendacky, Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38aca18b-4312-5e03-fdd9-86e47c332e44@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=aarcange@redhat.com \
    --cc=bp@alien8.de \
    --cc=dwmw@amazon.co.uk \
    --cc=jkosina@suse.cz \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).