Re: [PATCH 1/4] x86/mm/pat: Handle no-GBPAGES case correctly in populate_pud

From: Ard Biesheuvel
Date: Wed Mar 04 2020 - 14:04:24 EST


On Wed, 4 Mar 2020 at 19:50, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> On Wed, Mar 04, 2020 at 07:44:50PM +0100, Ard Biesheuvel wrote:
> >
> > I've tried a couple of different ways, but I can't seem to get my
> > memory map organized in the way that will trigger the error.
>
> What does yours look like? efi_merge_regions doesn't merge everything
> that will eventually be mapped the same way, so if there are some
> non-conventional memory regions scattered over the address space, it
> might be breaking up the mappings to the point where this doesn't
> trigger.

I have a region

[ 0.000000] efi: mem07: [Conventional Memory| | | | | | | |
| |WB|WT|WC|UC] range=[0x0000000001400000-0x00000000b9855fff]
(2948MB)

which gets covered correctly

[ 0.401766] 0x0000000000a00000-0x0000000040000000 1014M
RW PSE NX pmd
[ 0.403436] 0x0000000040000000-0x0000000080000000 1G
RW PSE NX pud
[ 0.404645] 0x0000000080000000-0x00000000b9800000 920M
RW PSE NX pmd
[ 0.405844] 0x00000000b9800000-0x00000000b9a00000 2M
RW NX pte
[ 0.407436] 0x00000000b9a00000-0x00000000baa00000 16M
ro PSE x pmd
[ 0.408591] 0x00000000baa00000-0x00000000bbe00000 20M
RW PSE NX pmd
[ 0.409751] 0x00000000bbe00000-0x00000000bc000000 2M
RW NX pte
[ 0.410821] 0x00000000bc000000-0x00000000be600000 38M
RW PSE NX pmd

However, the fact that you can provide a case where it does fail
should be sufficient justification for taking this patch. I was just
trying to give more than a regression-tested-by