On Thu, Aug 15, 2024 at 02:15:40PM +0800, Baoquan He wrote: > Cc Eric and kexec mailing list. > > On 08/14/24 at 03:46pm, Kirill A. Shutemov wrote: > > The init_transition_pgtable() function sets up transitional page tables. > > It ensures that the relocate_kernel() function is present in the > > identity mapping at the same location as in the kernel page tables. > > relocate_kernel() switches to the identity mapping, and the function > > must be present at the same location in the virtual address space before > > and after switching page tables. > > > > init_transition_pgtable() maps a copy of relocate_kernel() in > > image->control_code_page at the relocate_kernel() virtual address, but > > the original physical address of relocate_kernel() would also work. > > > > It is safe to use original relocate_kernel() physical address cannot be > > overwritten until swap_pages() is called, and the relocate_kernel() > > virtual address will not be used by then. > > I haven't read these codes for long time, wondering if we still need > copy relocate_kernel() to image->control_code_page + PAGE_SIZE as you > said. I think we can get away with only coping starting with identity_mapped(). But given that KEXEC_CONTROL_CODE_MAX_SIZE is 2K I don't see a reason to change anything here. -- Kiryl Shutsemau / Kirill A. Shutemov