[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d24f7bae-9581-4d1a-ae05-2fede38b5e1f@amd.com>
Date: Fri, 28 Jun 2024 16:22:59 -0500
From: "Kalra, Ashish" <ashish.kalra@....com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"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>,
"mhklinux@...look.com" <mhklinux@...look.com>, "Rodel, Jorg"
<jroedel@...e.de>, "hpa@...or.com" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"thomas.lendacky@....com" <thomas.lendacky@....com>,
"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/2024 3:58 PM, Edgecombe, Rick P wrote:
> On Fri, 2024-06-28 at 20:52 +0000, Ashish Kalra wrote:
>> diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
>> index 443a97e515c0..be8b5bf3bc3f 100644
>> --- a/arch/x86/mm/pat/set_memory.c
>> +++ b/arch/x86/mm/pat/set_memory.c
>> @@ -672,6 +672,7 @@ pte_t *lookup_address_in_pgd_attr(pgd_t *pgd, unsigned
>> long address,
>> p4d_t *p4d;
>> pud_t *pud;
>> pmd_t *pmd;
>> + pte_t *pte;
>>
>> *level = PG_LEVEL_256T;
>> *nx = false;
>> @@ -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.
Thanks, Ashish
Powered by blists - more mailing lists