Re: [PATCH 01/11] x86/mm: factor out pageattr _PAGE_GLOBAL setting

From: Dave Hansen
Date: Mon Apr 02 2018 - 16:23:11 EST


On 04/02/2018 10:52 AM, Linus Torvalds wrote:
> On Mon, Apr 2, 2018 at 10:27 AM, Dave Hansen
> <dave.hansen@xxxxxxxxxxxxxxx> wrote:
>>
>> Aside: _PAGE_GLOBAL is ignored when CR4.PGE=1, so why do we
>> even go to the trouble of filtering it anywhere?
>
> I'm assuming this is a typo, and you mean "when CR4.PGE=0".

Yes, that is a typo.

> The question you raise may be valid, but within the particular context
> of *this* patch it is not.

I thought it was relevant because I was asking myself: Why is it OK for
the (old) code to be doing this:

> - if (pgprot_val(req_prot) & _PAGE_PRESENT)
> - pgprot_val(req_prot) |= _PAGE_PSE | _PAGE_GLOBAL;

When _PAGE_GLOBAL is not supported. This "Aside" got moved a bit away
from the comment, but I actually mean to refer to the comment that talks
about canon_pgprot():

>> canon_pgprot() will clear it if unsupported,
>> but we *always* set it.

and its use of __supported_pte_mask.

I'll redo the changelog a bit and hopefully capture all this along with
correcting the typo.