Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389140 > unrolled thread

Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for AMD processors

Started byAndy Lutomirski <luto@amacapital.net>
First post2016-04-27 16:40 +0200
Last post2016-04-27 17:50 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for  AMD processors Andy Lutomirski <luto@amacapital.net> - 2016-04-27 16:40 +0200
    Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for  AMD processors Andy Lutomirski <luto@amacapital.net> - 2016-04-27 16:50 +0200
      Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for  AMD processors Andy Lutomirski <luto@amacapital.net> - 2016-04-27 17:20 +0200
        Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for  AMD processors Borislav Petkov <bp@alien8.de> - 2016-04-27 17:40 +0200
          Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for  AMD processors Andy Lutomirski <luto@amacapital.net> - 2016-04-27 17:50 +0200

#1389140 — Re: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for AMD processors

FromAndy Lutomirski <luto@amacapital.net>
Date2016-04-27 16:40 +0200
SubjectRe: [RFC PATCH v1 01/18] x86: Set the write-protect cache mode for AMD processors
Message-ID<rsyNd-2L2-39@gated-at.bofh.it>
On Tue, Apr 26, 2016 at 3:56 PM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
> For AMD processors that support PAT, set the write-protect cache mode
> (_PAGE_CACHE_MODE_WP) entry to the actual write-protect value (x05).

What's the purpose of using the WP memory type?

--Andy

[toc] | [next] | [standalone]


#1389172

FromAndy Lutomirski <luto@amacapital.net>
Date2016-04-27 16:50 +0200
Message-ID<rsyWS-2P1-23@gated-at.bofh.it>
In reply to#1389140
On Wed, Apr 27, 2016 at 7:44 AM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
> On 04/27/2016 09:33 AM, Andy Lutomirski wrote:
>> On Tue, Apr 26, 2016 at 3:56 PM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>> For AMD processors that support PAT, set the write-protect cache mode
>>> (_PAGE_CACHE_MODE_WP) entry to the actual write-protect value (x05).
>>
>> What's the purpose of using the WP memory type?
>
> The WP memory type is used for encrypting or decrypting data "in place".
> The use of the WP on the source data will prevent any of the source
> data from being cached.  Refer to section 7.10.8 "Encrypt-in-Place" in
> the AMD64 APM link provided in the cover letter.
>
> This memory type will be used in subsequent patches for this purpose.

OK.

Why AMD-only?  I thought Intel supported WP, too.

--Andy

[toc] | [prev] | [next] | [standalone]


#1389217

FromAndy Lutomirski <luto@amacapital.net>
Date2016-04-27 17:20 +0200
Message-ID<rszpU-3jV-9@gated-at.bofh.it>
In reply to#1389172
On Wed, Apr 27, 2016 at 8:05 AM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
> On 04/27/2016 09:47 AM, Andy Lutomirski wrote:
>> On Wed, Apr 27, 2016 at 7:44 AM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>> On 04/27/2016 09:33 AM, Andy Lutomirski wrote:
>>>> On Tue, Apr 26, 2016 at 3:56 PM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>>>> For AMD processors that support PAT, set the write-protect cache mode
>>>>> (_PAGE_CACHE_MODE_WP) entry to the actual write-protect value (x05).
>>>>
>>>> What's the purpose of using the WP memory type?
>>>
>>> The WP memory type is used for encrypting or decrypting data "in place".
>>> The use of the WP on the source data will prevent any of the source
>>> data from being cached.  Refer to section 7.10.8 "Encrypt-in-Place" in
>>> the AMD64 APM link provided in the cover letter.
>>>
>>> This memory type will be used in subsequent patches for this purpose.
>>
>> OK.
>>
>> Why AMD-only?  I thought Intel supported WP, too.
>
> Just me being conservative. If there aren't any objections from the
> Intel folks about it we can remove the vendor check and just set it.

I think there are some errata that will cause high PAT references to
incorrectly reference the low parts of the table, but I don't recall
any that go the other way around.  So merely setting WP in a high
entry should be harmless unless something tries to use it.

>
> Thanks,
> Tom
>
>>
>> --Andy
>>



-- 
Andy Lutomirski
AMA Capital Management, LLC

[toc] | [prev] | [next] | [standalone]


#1389248

FromBorislav Petkov <bp@alien8.de>
Date2016-04-27 17:40 +0200
Message-ID<rszJh-3tA-49@gated-at.bofh.it>
In reply to#1389217
On Wed, Apr 27, 2016 at 08:12:56AM -0700, Andy Lutomirski wrote:
> I think there are some errata

Isn't that addressed by the first branch of the if-test in pat_init():

        if ((c->x86_vendor == X86_VENDOR_INTEL) &&
            (((c->x86 == 0x6) && (c->x86_model <= 0xd)) ||
             ((c->x86 == 0xf) && (c->x86_model <= 0x6)))) {


-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

[toc] | [prev] | [next] | [standalone]


#1389270

FromAndy Lutomirski <luto@amacapital.net>
Date2016-04-27 17:50 +0200
Message-ID<rszSV-3yc-7@gated-at.bofh.it>
In reply to#1389248
On Wed, Apr 27, 2016 at 8:31 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Wed, Apr 27, 2016 at 08:12:56AM -0700, Andy Lutomirski wrote:
>> I think there are some errata
>
> Isn't that addressed by the first branch of the if-test in pat_init():
>
>         if ((c->x86_vendor == X86_VENDOR_INTEL) &&
>             (((c->x86 == 0x6) && (c->x86_model <= 0xd)) ||
>              ((c->x86 == 0xf) && (c->x86_model <= 0x6)))) {
>

That's the intent, but I'm unconvinced that it's complete.  The reason
that WT is in slot 7 is that if it accidentally ends up using the slot
3 entry instead of 7 (e.g. if a 2M page gets confused due to an
erratum we didn't handle or similar), then it falls back to UC, which
is safe.

But this is mostly moot in this case.  There is no safe fallback for
WP, but it doesn't really matter, because no one will actually try to
use it except on a system will full PAT support anyway.  So I'm not
really concerned.

>
> --
> Regards/Gruss,
>     Boris.
>
> ECO tip #101: Trim your mails when you reply.



-- 
Andy Lutomirski
AMA Capital Management, LLC

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web