Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash: let arch decide usable memory range in reserved area

Although the crashkernel area is reserved, on architectures like PowerPC,
it is possible for the crashkernel reserved area to contain components
like RTAS, TCE, OPAL, etc. To avoid placing kexec segments over these
components, PowerPC has its own set of APIs to locate holes in the
crashkernel reserved area.

Add an arch hook in the generic locate mem hole APIs so that architectures
can handle such special regions in the crashkernel area while locating
memory holes for kexec segments using generic APIs. With this, a lot of
redundant arch-specific code can be removed, as it performs the exact same
job as the generic APIs.

To keep the generic and arch-specific changes separate, the changes
related to moving PowerPC to use the generic APIs and the removal of
PowerPC-specific APIs for memory hole allocation are done in a subsequent
patch titled "powerpc/crash: Use generic APIs to locate memory hole for
kdump.

Link: https://lkml.kernel.org/r/20250131113830.925179-4-sourabhjain@linux.ibm.com
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sourabh Jain and committed by
Andrew Morton
9f0552c9 7b54a96f

+21
+9
include/linux/kexec.h
··· 205 205 } 206 206 #endif 207 207 208 + #ifndef arch_check_excluded_range 209 + static inline int arch_check_excluded_range(struct kimage *image, 210 + unsigned long start, 211 + unsigned long end) 212 + { 213 + return 0; 214 + } 215 + #endif 216 + 208 217 #ifdef CONFIG_KEXEC_SIG 209 218 #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION 210 219 int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
+12
kernel/kexec_file.c
··· 464 464 continue; 465 465 } 466 466 467 + /* Make sure this does not conflict with exclude range */ 468 + if (arch_check_excluded_range(image, temp_start, temp_end)) { 469 + temp_start = temp_start - PAGE_SIZE; 470 + continue; 471 + } 472 + 467 473 /* We found a suitable memory range */ 468 474 break; 469 475 } while (1); ··· 500 494 * segments 501 495 */ 502 496 if (kimage_is_destination_range(image, temp_start, temp_end)) { 497 + temp_start = temp_start + PAGE_SIZE; 498 + continue; 499 + } 500 + 501 + /* Make sure this does not conflict with exclude range */ 502 + if (arch_check_excluded_range(image, temp_start, temp_end)) { 503 503 temp_start = temp_start + PAGE_SIZE; 504 504 continue; 505 505 }