[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd80d0bf-f28f-45ab-974e-79d50f35764f@amd.com>
Date: Tue, 20 Feb 2024 13:09:37 -0600
From: "Kalra, Ashish" <ashish.kalra@....com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, luto@...nel.org, x86@...nel.org,
ardb@...nel.org, hpa@...or.com, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org, rafael@...nel.org, peterz@...radead.org,
adrian.hunter@...el.com, sathyanarayanan.kuppuswamy@...ux.intel.com,
elena.reshetova@...el.com, jun.nakajima@...el.com,
rick.p.edgecombe@...el.com, thomas.lendacky@....com, seanjc@...gle.com,
kai.huang@...el.com, bhe@...hat.com, kexec@...ts.infradead.org,
linux-coco@...ts.linux.dev, anisinha@...hat.com, michael.roth@....com,
bdas@...hat.com, vkuznets@...hat.com, dionnaglaze@...gle.com,
jroedel@...e.de, ashwin.kamat@...adcom.com
Subject: Re: [PATCH 1/2] x86/mm: Do not zap PMD entry mapping unaccepted
memory table during kdump.
Hi Kirill,
On 2/20/2024 6:42 AM, Kirill A. Shutemov wrote:
> On Tue, Feb 20, 2024 at 01:18:29AM +0000, Ashish Kalra wrote:
>> From: Ashish Kalra <ashish.kalra@....com>
>>
>> During crashkernel boot only pre-allocated crash memory is presented as
>> E820_TYPE_RAM. This can cause PMD entry mapping unaccepted memory table
>> to be zapped during phys_pmd_init() as SNP/TDX guest use E820_TYPE_ACPI
>> to store the unaccepted memory table and pass it between the kernels on
>> kexec/kdump.
>>
>> E820_TYPE_ACPI covers not only ACPI data, but also EFI tables and might
>> be required by kernel to function properly.
>>
>> The problem was discovered during debugging kdump for SNP guest. The
>> unaccepted memory table stored with E820_TYPE_ACPI and passed between
>> the kernels on kdump was getting zapped as the PMD entry mapping this
>> is above the E820_TYPE_RAM range for the reserved crashkernel memory.
>>
>> Signed-off-by: Ashish Kalra <ashish.kalra@....com>
>> ---
>> arch/x86/mm/init_64.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
>> index a0dffaca6d2b..207c6dddde0c 100644
>> --- a/arch/x86/mm/init_64.c
>> +++ b/arch/x86/mm/init_64.c
>> @@ -524,7 +524,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
>> !e820__mapped_any(paddr & PMD_MASK, paddr_next,
>> E820_TYPE_RAM) &&
>> !e820__mapped_any(paddr & PMD_MASK, paddr_next,
>> - E820_TYPE_RESERVED_KERN))
>> + E820_TYPE_RESERVED_KERN) &&
>> + !e820__mapped_any(paddr & PMD_MASK, paddr_next,
>> + E820_TYPE_ACPI))
>> set_pmd_init(pmd, __pmd(0), init);
>> continue;
> Why do you single out phys_pmd_init()? I think it has to be addressed for
> all page table levels as we do for E820_TYPE_RAM and E820_TYPE_RESERVED_KERN.
I believe i only discovered the issue with PMDe's (phys_pmd_init())
because of the crashkernel reserved memory size and the E820_TYPE_ACPI
physical memory range mapping on my test system, but you are right this
fix needs to be done for all page table levels and i will add also the
fix in phys_pte_init(), phys_pud_init() and phys_p4d_init().
Thanks, Ashish
Powered by blists - more mailing lists