Skip to content

Commit 0d124e9

Browse files
Baoquan Hewilldeacon
authored andcommitted
arm64: kdump : take off the protection on crashkernel memory region
Problem: ======= On arm64, block and section mapping is supported to build page tables. However, currently it enforces to take base page mapping for the whole linear mapping if CONFIG_ZONE_DMA or CONFIG_ZONE_DMA32 is enabled and crashkernel kernel parameter is set. This will cause longer time of the linear mapping process during bootup and severe performance degradation during running time. Root cause: ========== On arm64, crashkernel reservation relies on knowing the upper limit of low memory zone because it needs to reserve memory in the zone so that devices' DMA addressing in kdump kernel can be satisfied. However, the upper limit of low memory on arm64 is variant. And the upper limit can only be decided late till bootmem_init() is called [1]. And we need to map the crashkernel region with base page granularity when doing linear mapping, because kdump needs to protect the crashkernel region via set_memory_valid(,0) after kdump kernel loading. However, arm64 doesn't support well on splitting the built block or section mapping due to some cpu reststriction [2]. And unfortunately, the linear mapping is done before bootmem_init(). To resolve the above conflict on arm64, the compromise is enforcing to take base page mapping for the entire linear mapping if crashkernel is set, and CONFIG_ZONE_DMA or CONFIG_ZONE_DMA32 is enabed. Hence performance is sacrificed. Solution: ========= Comparing with the base page mapping for the whole linear region, it's better to take off the protection on crashkernel memory region for the time being because the anticipated stamping on crashkernel memory region could only happen in a chance in one million, while the base page mapping for the whole linear region is mitigating arm64 systems with crashkernel set always. [1] https://lore.kernel.org/all/[email protected]/T/#u [2] https://lore.kernel.org/linux-arm-kernel/[email protected]/T/ Signed-off-by: Baoquan He <[email protected]> Acked-by: Catalin Marinas <[email protected]> Acked-by: Mike Rapoport (IBM) <[email protected]> Reviewed-by: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e8d018d commit 0d124e9

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

arch/arm64/include/asm/kexec.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@ void cpu_soft_restart(unsigned long el2_switch, unsigned long entry,
102102

103103
int machine_kexec_post_load(struct kimage *image);
104104
#define machine_kexec_post_load machine_kexec_post_load
105-
106-
void arch_kexec_protect_crashkres(void);
107-
#define arch_kexec_protect_crashkres arch_kexec_protect_crashkres
108-
109-
void arch_kexec_unprotect_crashkres(void);
110-
#define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres
111105
#endif
112106

113107
#define ARCH_HAS_KIMAGE_ARCH

arch/arm64/kernel/machine_kexec.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -268,26 +268,6 @@ void machine_crash_shutdown(struct pt_regs *regs)
268268
pr_info("Starting crashdump kernel...\n");
269269
}
270270

271-
void arch_kexec_protect_crashkres(void)
272-
{
273-
int i;
274-
275-
for (i = 0; i < kexec_crash_image->nr_segments; i++)
276-
set_memory_valid(
277-
__phys_to_virt(kexec_crash_image->segment[i].mem),
278-
kexec_crash_image->segment[i].memsz >> PAGE_SHIFT, 0);
279-
}
280-
281-
void arch_kexec_unprotect_crashkres(void)
282-
{
283-
int i;
284-
285-
for (i = 0; i < kexec_crash_image->nr_segments; i++)
286-
set_memory_valid(
287-
__phys_to_virt(kexec_crash_image->segment[i].mem),
288-
kexec_crash_image->segment[i].memsz >> PAGE_SHIFT, 1);
289-
}
290-
291271
#ifdef CONFIG_HIBERNATION
292272
/*
293273
* To preserve the crash dump kernel image, the relevant memory segments

0 commit comments

Comments
 (0)