All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: speck@linutronix.de
Subject: Re: [patch 13/15] SSB updates V17 13
Date: Thu, 17 May 2018 10:45:30 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1805171043370.1947@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20180517020804.GJ10272@char.us.oracle.com>

On Wed, 16 May 2018, speck for Konrad Rzeszutek Wilk wrote:
> On Wed, May 16, 2018 at 03:51:45PM +0200, speck for Thomas Gleixner wrote:
> > Subject: [patch 13/15] x86/bugs: Rework spec_ctrl base and mask logic
> > From: Thomas Gleixner <tglx@linutronix.de>
> > 
> > x86_spec_ctrL_mask is intended to mask out bits from a MSR_SPEC_CTRL value
> > which are not to be modified. However the implementation is not really used
> > and the bitmask is inverted for no real reason. Aside of that it is missing
> 
> It is inverted to make the check easier. That is the code (but removed in the prior
> patch) had:
> 
> 	if (val & x86_spec_ctrl_mask)
> 		complain..
> 
> Perhaps: s/for no real reason/to make the check easier - but removed in
> "x86/bugs: Remove x86_spec_ctrl_set()"/ ?

Fixed.

> > the STIBP bit if it is supported by the platform, so if the mask would be
> > used in x86_virt_spec_ctrl() then it would prevent a guest from setting
> > STIBP.
> > 
> > Add the STIBP bit if supported and use the mask in x86_spec_ctrl_set_guest()
> 
> s/x86_spec_ctrl_set_guest/x86_virt_spec_ctrl/

Fixed.

> >  void
> > -x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool guest)
> > +x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
> 
> Would it make sense to roll in the s/guest/setguest/ in the
> "x86/bugs: Unify x86_spec_ctrl_{set_guest,restore_host}" patch?

Done.

> >  {
> > +	u64 msrval, guestval, hostval = x86_spec_ctrl_base;
> >  	struct thread_info *ti = current_thread_info();
> > -	u64 msr, host = x86_spec_ctrl_base;
> >  
> >  	/* Is MSR_SPEC_CTRL implemented ? */
> >  	if (static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) {
> > +		/*
> > +		 * Restrict guest_spec_ctrl to supported values. Clear the
> > +		 * modifiable bits in the host base value and or the
> > +		 * modifiable bits from the guest value.
> > +		 */
> > +		guestval = hostval & ~x86_spec_ctrl_mask;
> > +		guestval |= guest_spec_ctrl & x86_spec_ctrl_mask;
> 
> How come the guestval is not used at all in this patch?

Because I'm a moron. Delta fix below.

Thanks,

	tglx
8<-------------------------

--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -157,8 +157,8 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl,
 		if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD))
 			hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
 
-		if (hostval != guest_spec_ctrl) {
-			msrval = setguest ? guest_spec_ctrl : hostval;
+		if (hostval != guestval) {
+			msrval = setguest ? guestval : hostval;
 			wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
 		}
 	}

  reply	other threads:[~2018-05-17  8:45 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 13:51 [patch 00/15] SSB updates V17 0 Thomas Gleixner
2018-05-16 13:51 ` [patch 01/15] SSB updates V17 1 Thomas Gleixner
2018-05-16 13:51 ` [patch 02/15] SSB updates V17 2 Thomas Gleixner
2018-05-16 14:29   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 03/15] SSB updates V17 3 Thomas Gleixner
2018-05-17  1:06   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 04/15] SSB updates V17 4 Thomas Gleixner
2018-05-17  1:14   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 05/15] SSB updates V17 5 Thomas Gleixner
2018-05-17  1:14   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 06/15] SSB updates V17 6 Thomas Gleixner
2018-05-17  1:28   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 07/15] SSB updates V17 7 Thomas Gleixner
2018-05-17  1:29   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 08/15] SSB updates V17 8 Thomas Gleixner
2018-05-16 21:13   ` [MODERATED] " Tom Lendacky
2018-05-17  2:56     ` Konrad Rzeszutek Wilk
2018-05-17 16:13       ` Tom Lendacky
2018-05-17 16:17         ` Paolo Bonzini
2018-05-17 16:23           ` Konrad Rzeszutek Wilk
2018-05-17 21:25           ` Tom Lendacky
2018-05-17 16:18         ` Tom Lendacky
2018-05-16 13:51 ` [patch 09/15] SSB updates V17 9 Thomas Gleixner
2018-05-17  1:40   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 10/15] SSB updates V17 10 Thomas Gleixner
2018-05-17  1:43   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 11/15] SSB updates V17 11 Thomas Gleixner
2018-05-17  1:45   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 13:51 ` [patch 12/15] SSB updates V17 12 Thomas Gleixner
2018-05-16 13:51 ` [patch 13/15] SSB updates V17 13 Thomas Gleixner
2018-05-17  2:08   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-17  8:45     ` Thomas Gleixner [this message]
2018-05-16 13:51 ` [patch 14/15] SSB updates V17 14 Thomas Gleixner
2018-05-16 16:34   ` [MODERATED] " Tom Lendacky
2018-05-16 21:26     ` Thomas Gleixner
2018-05-16 13:51 ` [patch 15/15] SSB updates V17 15 Thomas Gleixner
2018-05-17  2:18   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-17 12:42     ` Paolo Bonzini
2018-05-17 15:09       ` Thomas Gleixner
2018-05-16 14:09 ` [patch 00/15] SSB updates V17 0 Thomas Gleixner

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.1805171043370.1947@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=speck@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.