linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Borislav Petkov <bp@alien8.de>
Cc: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	"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: Tue, 11 Dec 2018 19:37:26 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1812111910520.22893@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20181212000518.GX27375@zn.tnic>

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:

> > - 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?

	tglx

  reply	other threads:[~2018-12-12  3:37 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 [this message]
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
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=alpine.DEB.2.21.1812111910520.22893@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=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=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).