All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: speck@linutronix.de
Subject: Re: [patch 03/15] Hidden 3
Date: Wed, 16 May 2018 10:07:55 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1805160955420.1627@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20180516024930.GD18660@char.us.oracle.com>

On Tue, 15 May 2018, speck for Konrad Rzeszutek Wilk wrote:
> On Sun, May 13, 2018 at 04:00:51PM +0200, speck for Thomas Gleixner wrote:
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -64,7 +64,7 @@ void __init check_bugs(void)
> >  	 * have unknown values. AMD64_LS_CFG MSR is cached in the early AMD
> >  	 * init code as it is not enumerated and depends on the family.
> >  	 */
> > -	if (boot_cpu_has(X86_FEATURE_IBRS))
> > +	if (boot_cpu_has(X86_FEATURE_MSR_SPEC_CTRL))
> >  		rdmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
> >  
> >  	/* Select the proper spectre mitigation before patching alternatives */
> > @@ -145,7 +145,7 @@ u64 x86_spec_ctrl_get_default(void)
> >  {
> >  	u64 msrval = x86_spec_ctrl_base;
> >  
> > -	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
> > +	if (static_cpu_has(X86_FEATURE_SPEC_CTRL))
> 
> You are using the static_cpu_has which ends up doing alternative
> patching - neat.
> 
> But what if the machine at bootup has no SPEC_CTRL MSR support at all,
> and then we end up loading a new microcode with this and then suddenly
> SPEC_CTRL MSR is available?
> 
> Wouldn't the static_cpu_has in this scenario end up always returning false?
> 
> [And this may all be moot - perhaps we don't support this scenario?]

Allowing it after late micro code loading might work, but it just works
because x86_spec_ctrl_base is initialized to 0, which happens to be the
right default value. But it's not working by design.

Similarly, we don't reevaluate mitigation selection and command line
options after early boot, so just special casing it for virtualization does
not make much sense to me. 

We can change it back, but then then we need some way to check that
SPEC_CTRL_MSR reads 0 at detection time and audit everything else whether
it can run into weird inconsistent state as we have to deal with a
bunch of variants here.

I'm all for keeping it simple and just treat it like a CPU upgrade which
you can't do on a running system either.

Thanks,

	tglx

  reply	other threads:[~2018-05-16  8:07 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13 14:00 [patch 00/15] Hidden 0 Thomas Gleixner
2018-05-13 14:00 ` [patch 01/15] Hidden 1 Thomas Gleixner
2018-05-13 22:17   ` [MODERATED] " Borislav Petkov
2018-05-15  9:30   ` Paolo Bonzini
2018-05-16  2:32   ` Konrad Rzeszutek Wilk
2018-05-16  7:51     ` Thomas Gleixner
2018-05-13 14:00 ` [patch 02/15] Hidden 2 Thomas Gleixner
2018-05-16  2:39   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-13 14:00 ` [patch 03/15] Hidden 3 Thomas Gleixner
2018-05-14 10:02   ` [MODERATED] " Borislav Petkov
2018-05-16  2:49   ` Konrad Rzeszutek Wilk
2018-05-16  8:07     ` Thomas Gleixner [this message]
2018-05-16  8:53       ` [MODERATED] " Borislav Petkov
2018-05-13 14:00 ` [patch 04/15] Hidden 4 Thomas Gleixner
2018-05-14 11:11   ` [MODERATED] " Borislav Petkov
2018-05-16  2:53   ` Konrad Rzeszutek Wilk
2018-05-13 14:00 ` [patch 05/15] Hidden 5 Thomas Gleixner
2018-05-14 11:18   ` [MODERATED] " Borislav Petkov
2018-05-16  3:24   ` Konrad Rzeszutek Wilk
2018-05-16  9:09     ` Thomas Gleixner
2018-05-13 14:00 ` [patch 06/15] Hidden 6 Thomas Gleixner
2018-05-14 12:01   ` [MODERATED] " Borislav Petkov
2018-05-14 12:09   ` Peter Zijlstra
2018-05-14 12:46     ` Thomas Gleixner
2018-05-16  3:15   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16  8:44     ` Thomas Gleixner
2018-05-13 14:00 ` [patch 07/15] Hidden 7 Thomas Gleixner
2018-05-14 17:07   ` [MODERATED] " Borislav Petkov
2018-05-16  3:22   ` Konrad Rzeszutek Wilk
2018-05-16  8:46     ` Thomas Gleixner
2018-05-16 12:15       ` Thomas Gleixner
2018-05-13 14:00 ` [patch 08/15] Hidden 8 Thomas Gleixner
2018-05-14 17:58   ` [MODERATED] " Borislav Petkov
2018-05-16  3:31   ` Konrad Rzeszutek Wilk
2018-05-16 12:22     ` Thomas Gleixner
2018-05-16 13:48       ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-13 14:00 ` [patch 09/15] Hidden 9 Thomas Gleixner
2018-05-14 19:49   ` [MODERATED] " Borislav Petkov
2018-05-13 14:00 ` [patch 10/15] Hidden 10 Thomas Gleixner
2018-05-16  3:38   ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16  8:51     ` Thomas Gleixner
2018-05-13 14:00 ` [patch 11/15] Hidden 11 Thomas Gleixner
2018-05-14 20:02   ` [MODERATED] " Borislav Petkov
2018-05-16  3:35   ` Konrad Rzeszutek Wilk
2018-05-16  8:50     ` Thomas Gleixner
2018-05-13 14:01 ` [patch 12/15] Hidden 12 Thomas Gleixner
2018-05-14 20:18   ` [MODERATED] " Borislav Petkov
2018-05-16  3:40   ` Konrad Rzeszutek Wilk
2018-05-13 14:01 ` [patch 13/15] Hidden 13 Thomas Gleixner
2018-05-15  9:27   ` [MODERATED] " Borislav Petkov
2018-05-16  3:42   ` Konrad Rzeszutek Wilk
2018-05-16  8:56     ` Thomas Gleixner
2018-05-13 14:01 ` [patch 14/15] Hidden 14 Thomas Gleixner
2018-05-15 15:35   ` [MODERATED] " Borislav Petkov
2018-05-16  3:44   ` Konrad Rzeszutek Wilk
2018-05-13 14:01 ` [patch 15/15] Hidden 15 Thomas Gleixner
2018-05-13 14:22 ` [patch 00/15] Hidden 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.1805160955420.1627@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.