On x86_32 Qemu machine with 1GB memory, the cmdline "crashkernel=4G" is ok as below: crashkernel reserved: 0x0000000020000000 - 0x0000000120000000 (4096 MB) The cause is that the crash_size is parsed and printed with "unsigned long long" data type which is 8 bytes but allocated used with "phys_addr_t" which is 4 bytes in memblock_phys_alloc_range(). Fix it by checking if the crash_size is greater than system RAM size and warn out if so as Baoquan suggested. After this patch, it fails and warn out as expected and no above confusing reserve success info. Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Suggested-by: Baoquan He <bhe@xxxxxxxxxx> --- v3: - Handle the check in arch_reserve_crashkernel() Baoquan suggested. - Split x86_32 and arm32. - Add Suggested-by. - Drop the wrong fix tag. v2: - Also fix for x86_32. - Update the fix method. - Peel off the other two patches. - Update the commit message. --- arch/x86/kernel/setup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 05c5aa951da7..c26373029b77 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -481,6 +481,11 @@ static void __init arch_reserve_crashkernel(void) if (ret) return; + if (crash_size >= memblock_phys_mem_size()) { + pr_warn("Crashkernel reserve memory cannot exceed physical memory."); + return; + } + if (xen_pv_domain()) { pr_info("Ignoring crashkernel for a Xen PV domain\n"); return; -- 2.34.1 _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec