[PATCH v2 1/1] kexec_core: Accept unaccepted kexec segments' destination addresses
Kirill A. Shutemov
kirill.shutemov at linux.intel.com
Fri Feb 14 05:37:51 PST 2025
On Thu, Feb 13, 2025 at 07:50:42AM -0800, Dave Hansen wrote:
> On 12/13/24 01:54, Yan Zhao wrote:
> > + /*
> > + * The destination addresses are searched from system RAM rather than
> > + * being allocated from the buddy allocator, so they are not guaranteed
> > + * to be accepted by the current kernel. Accept the destination
> > + * addresses before kexec swaps their content with the segments' source
> > + * pages to avoid accessing memory before it is accepted.
> > + */
> > + for (i = 0; i < nr_segments; i++)
> > + accept_memory(image->segment[i].mem, image->segment[i].memsz);
>
> The "searched from system RAM" phrase both here and in the changelog
> doesn't quite parse for me.
>
> Also "System RAM" is the normal phrase that I use to describe the memory
> that mostly ends up _going_ into the buddy allocator. It's not just me:
>
> cat /proc/iomem | grep 'System RAM'
>
> I think a more useful comment (and changelog) might be something like this:
>
> The core kernel focuses on accepting memory which is known to be
> System RAM. However, there might be areas that are reserved in
> the memory map, not exposed to the kernel as "System RAM" and
> not accepted by firmware. Accept the memory before kexec touches
> it.
If kernel compiled with CONFIG_UNACCEPTED_MEMORY, EFI_UNACCEPTED_MEMORY
is part of System RAM. It translates to E820_TYPE_RAM. See setup_e820() in
EFI stub.
--
Kiryl Shutsemau / Kirill A. Shutemov
More information about the kexec
mailing list