[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e633c592-5513-bf5e-800d-b92fece86c33@amd.com>
Date: Fri, 28 Jun 2024 16:36:20 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"ashish.kalra@....com" <ashish.kalra@....com>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>, "luto@...nel.org" <luto@...nel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"bp@...en8.de" <bp@...en8.de>
Cc: "jgross@...e.com" <jgross@...e.com>, "x86@...nel.org" <x86@...nel.org>,
"Rodel, Jorg" <jroedel@...e.de>, "mhklinux@...look.com"
<mhklinux@...look.com>, "hpa@...or.com" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>
Subject: Re: [PATCH] x86/mm: fix lookup_address() to handle physical memory
holes in direct mapping
On 6/28/24 16:33, Edgecombe, Rick P wrote:
> On Fri, 2024-06-28 at 16:22 -0500, Kalra, Ashish wrote:
>>>> @@ -717,7 +718,11 @@ pte_t *lookup_address_in_pgd_attr(pgd_t *pgd,
>>>> unsigned
>>>> long address,
>>>> *nx |= pmd_flags(*pmd) & _PAGE_NX;
>>>> *rw &= pmd_flags(*pmd) & _PAGE_RW;
>>>>
>>>> - return pte_offset_kernel(pmd, address);
>>>> + pte = pte_offset_kernel(pmd, address);
>>>> + if (pte_none(*pte))
>>>> + return NULL;
>>>> +
>>>> + return pte;
>>> The other levels check for pXX_none() before adjusting *level. Not sure what
>>> the
>>> effect would be, but I think it should be the same behavior for all.
>>
>> If we are returning NULL, why should adjusting *level matter.
>
> Well, I think symmetry is enough of a reason, but actually it should be ok.
>
> I was looking at this diff compared to my working tree, but this tip commit
Ditto for me.
Thanks,
Tom
> (which is about that scenario) makes it set *level before checking none for all
> of them:
> https://lore.kernel.org/lkml/171871930159.10875.16081839197437299007.tip-bot2@tip-bot2/
>
> So sorry, nevermind.
Powered by blists - more mailing lists