All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Juergen Gross <jgross@suse.com>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH for-4.11] x86/spec_ctrl: Updates to retpoline-safety decision making
Date: Thu, 19 Apr 2018 11:26:57 +0100	[thread overview]
Message-ID: <0d8df6e5-b0a9-6e21-9fd4-f6765e9aca06@citrix.com> (raw)
In-Reply-To: <5AD85AA702000078001BC955@prv1-mh.provo.novell.com>

On 19/04/18 10:00, Jan Beulich wrote:
>>>> On 18.04.18 at 20:13, <andrew.cooper3@citrix.com> wrote:
>> @@ -151,6 +152,20 @@ static bool __init retpoline_safe(void)
>>           boot_cpu_data.x86 != 6 )
>>          return false;
>>  
>> +    if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
>> +    {
>> +        uint64_t caps;
>> +
>> +        rdmsrl(MSR_ARCH_CAPABILITIES, caps);
>> +
>> +        /*
>> +         * RBSA may be set by a hypervisor to indicate that we may move to a
>> +         * processor which isn't retpoline-safe.
>> +         */
>> +        if ( caps & ARCH_CAPS_RSBA )
>> +            return false;
>> +    }
> I assume handing this through / forcing it on for guests is meant to be
> done in a later patch?

Virtualisaing MSR_ARCH_CAPS for guests is in progress, but definitely
4.12 material.

It requires the toolstack CPUID/MSR improvements so this bit can be
levelled across resource pools, which means dusting off some fairly old
patches of mine, and getting them finished.

>
>> @@ -177,18 +192,37 @@ static bool __init retpoline_safe(void)
>>           * versions.
>>           */
>>      case 0x3d: /* Broadwell */
>> -        return ucode_rev >= 0x28;
>> +        return ucode_rev >= 0x2a;
>>      case 0x47: /* Broadwell H */
>> -        return ucode_rev >= 0x1b;
>> +        return ucode_rev >= 0x1d;
>>      case 0x4f: /* Broadwell EP/EX */
>> -        return ucode_rev >= 0xb000025;
>> +        return ucode_rev >= 0xb000021;
>>      case 0x56: /* Broadwell D */
>> -        return false; /* TBD. */
>> +        switch ( boot_cpu_data.x86_mask )
>> +        {
>> +        case 2:  return ucode_rev >= 0x15;
>> +        case 3:  return ucode_rev >= 0x7000012;
>> +        case 4:  return ucode_rev >= 0xf000011;
>> +        case 5:  return ucode_rev >= 0xe000009;
>> +        default: return false;
>> +        }
>> +        break;
> Hmm, the white paper says
> "The predictable speculative behavior of the RET instruction is the key to
>  retpoline being a robust mitigation. RET has this behavior on all processors
>  which are based on the Intel® microarchitecture codename Broadwell and
>  earlier when updated with the latest microcode."
>
> Am I to assume the text is imprecise, or else why is it that only Broadwells
> are being checked for ucode version?

Hmm yes - that does look like poor wording in the whitepaper.  It is the
case that Broadwell is the only uarch which needs the microcode check.

> Also the default case of the
> Broadwell sub-switch would perhaps better gain a printk() just like ...

Will do.

>
>>          /*
>> -         * Skylake and later processors are not retpoline-safe.
>> +         * Skylake, Kabylake and Cannonlake processors are not retpoline-safe.
>>           */
>> +    case 0x4e:
>> +    case 0x55:
>> +    case 0x5e:
>> +    case 0x66:
>> +    case 0x67:
>> +    case 0x8e:
>> +    case 0x9e:
>> +        return false;
>> +
>>      default:
>> +        printk("Unrecognised CPU model %#x - assuming not reptpoline safe\n",
>> +               boot_cpu_data.x86_model);
>>          return false;
> ... this one?
>
> Also, looking at ark.intel.com I find Coffee Lake, not Cannon Lake.

I was going from Linux's arch/x86/include/asm/intel-family.h which is
still on my TODO list to stea^W port to Xen, unless someone feels like
beating me to it.

It seems that Cannonlake may not actually be out yet, while Coffeelake
does look like it is definitely out.  I'm completely confused....

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-04-19 10:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 18:13 [PATCH for-4.11] x86/spec_ctrl: Updates to retpoline-safety decision making Andrew Cooper
2018-04-19  9:00 ` Jan Beulich
2018-04-19 10:26   ` Andrew Cooper [this message]
2018-04-19 12:04     ` Jan Beulich
2018-04-19 14:25 ` [PATCH v2 " Andrew Cooper
2018-04-19 15:02   ` Jan Beulich
2018-04-19 15:15   ` Juergen Gross
2018-04-23 21:16 ` [PATCH " Konrad Rzeszutek Wilk
2018-04-23 23:09   ` Andrew Cooper

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=0d8df6e5-b0a9-6e21-9fd4-f6765e9aca06@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xen.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 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.