[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a1a7f007-8552-45a1-bab3-8ebd0677ed54@amd.com>
Date: Fri, 28 Jun 2024 15:33:00 -0500
From: "Kalra, Ashish" <ashish.kalra@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
x86@...nel.org, rafael@...nel.org, hpa@...or.com, peterz@...radead.org,
adrian.hunter@...el.com, sathyanarayanan.kuppuswamy@...ux.intel.com,
jun.nakajima@...el.com, rick.p.edgecombe@...el.com, thomas.lendacky@....com,
michael.roth@....com, seanjc@...gle.com, kai.huang@...el.com,
bhe@...hat.com, kirill.shutemov@...ux.intel.com, bdas@...hat.com,
vkuznets@...hat.com, dionnaglaze@...gle.com, anisinha@...hat.com,
jroedel@...e.de, ardb@...nel.org, dyoung@...hat.com,
kexec@...ts.infradead.org, linux-coco@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 3/3] x86/snp: Convert shared memory back to private on
kexec
On 6/24/2024 1:26 PM, Borislav Petkov wrote:
>> + */
>> +
>> + addr = PAGE_OFFSET;
>> + end = PAGE_OFFSET + get_max_mapped();
>> +
>> + while (addr < end) {
>> + unsigned long size;
>> + unsigned int level;
>> + pte_t *pte;
>> +
>> + pte = lookup_address(addr, &level);
>> + size = page_level_size(level);
>> +
>> + /*
>> + * pte_none() check is required to skip physical memory holes in direct mapped.
> This sentence needs to be written for humans. And come to think of it, you can
> simply drop it. lookup_address() can return NULL so you simply need to check
> its retval.
I had to additionally add check for pte_none() here to handle physical memory holes in direct mapping.
Looking at lookup_address_in_pgd_attr(), at pte level it is simply returning pte_offset_kernel() and there does not seem to be a check for returning NULL if pte_none() ?
Probably need to fix lookup_address_in_pgd_attr(), to add check for pte_none() after pte_offset_kernel() and return NULL if it is true.
Thanks, Ashish
>> + */
>> + if (pte && pte_decrypted(*pte) && !pte_none(*pte)) {
>> + int pages = size / PAGE_SIZE;
>>
Powered by blists - more mailing lists