Skip to content

Commit 32fbe52

Browse files
Baoquan Heakpm00
authored andcommitted
crash: use macro to add crashk_res into iomem early for specific arch
There are regression reports[1][2] that crashkernel region on x86_64 can't be added into iomem tree sometime. This causes the later failure of kdump loading. This happened after commit 4a693ce ("kdump: defer the insertion of crashkernel resources") was merged. Even though, these reported issues are proved to be related to other component, they are just exposed after above commmit applied, I still would like to keep crashk_res and crashk_low_res being added into iomem early as before because the early adding has been always there on x86_64 and working very well. For safety of kdump, Let's change it back. Here, add a macro HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY to limit that only ARCH defining the macro can have the early adding crashk_res/_low_res into iomem. Then define HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY on x86 to enable it. Note: In reserve_crashkernel_low(), there's a remnant of crashk_low_res handling which was mistakenly added back in commit 85fcde4 ("kexec: split crashkernel reservation code out from crash_core.c"). [1] [PATCH V2] x86/kexec: do not update E820 kexec table for setup_data https://lore.kernel.org/all/[email protected]/T/#u [2] Question about Address Range Validation in Crash Kernel Allocation https://lore.kernel.org/all/[email protected]/T/#u Link: https://lkml.kernel.org/r/ZgDYemRQ2jxjLkq+@MiWiFi-R3L-srv Fixes: 4a693ce ("kdump: defer the insertion of crashkernel resources") Signed-off-by: Baoquan He <[email protected]> Cc: Dave Young <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Bohac <[email protected]> Cc: Li Huafei <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 25cd241 commit 32fbe52

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

arch/x86/include/asm/crash_reserve.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ static inline unsigned long crash_low_size_default(void)
3939
#endif
4040
}
4141

42+
#define HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY
43+
4244
#endif /* _X86_CRASH_RESERVE_H */

kernel/crash_reserve.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ static int __init reserve_crashkernel_low(unsigned long long low_size)
366366

367367
crashk_low_res.start = low_base;
368368
crashk_low_res.end = low_base + low_size - 1;
369+
#ifdef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY
369370
insert_resource(&iomem_resource, &crashk_low_res);
371+
#endif
370372
#endif
371373
return 0;
372374
}
@@ -448,8 +450,12 @@ void __init reserve_crashkernel_generic(char *cmdline,
448450

449451
crashk_res.start = crash_base;
450452
crashk_res.end = crash_base + crash_size - 1;
453+
#ifdef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY
454+
insert_resource(&iomem_resource, &crashk_res);
455+
#endif
451456
}
452457

458+
#ifndef HAVE_ARCH_ADD_CRASH_RES_TO_IOMEM_EARLY
453459
static __init int insert_crashkernel_resources(void)
454460
{
455461
if (crashk_res.start < crashk_res.end)
@@ -462,3 +468,4 @@ static __init int insert_crashkernel_resources(void)
462468
}
463469
early_initcall(insert_crashkernel_resources);
464470
#endif
471+
#endif

0 commit comments

Comments
 (0)