Re: [PATCH RESEND v1 5/5] crash: option to let arch decide mem range is usable
From: Baoquan he <hidden>
Date: 2025-01-08 11:39:38
Also in:
kexec, lkml
On 01/08/25 at 03:44pm, Sourabh Jain wrote: ...snip...
quoted hunk ↗ jump to hunk
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index f0e9f8eda7a3..407f8b0346aa 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h@@ -205,6 +205,15 @@ static inline int arch_kimage_file_post_load_cleanup(struct kimage *image) } #endif +#ifndef arch_check_excluded_range +static inline int arch_check_excluded_range(struct kimage *image, + unsigned long start, + unsigned long end) +{ + return 0; +} +#endif + #ifdef CONFIG_KEXEC_SIG #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 3eedb8c226ad..52e1480dbfa1 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c@@ -464,6 +464,12 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end, continue; } + /* Make sure this does not conflict exclude range */
^
Make sure this doesn't conflict with excluded range?
quoted hunk ↗ jump to hunk
+ if (arch_check_excluded_range(image, temp_start, temp_end)) { + temp_start = temp_start - PAGE_SIZE; + continue; + } + /* We found a suitable memory range */ break; } while (1);@@ -498,6 +504,12 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end, continue; } + /* Make sure this does not conflict exclude range */
^
Ditto.
+ if (arch_check_excluded_range(image, temp_start, temp_end)) {
+ temp_start = temp_start + PAGE_SIZE;
+ continue;
+ }
+
/* We found a suitable memory range */
break;
} while (1);
--
2.47.1