Commit 04a2a7af authored by Baoquan He's avatar Baoquan He Committed by Will Deacon

arm64: kdump: do not map crashkernel region specifically

After taking off the protection functions on crashkernel memory region,
there's no need to map crashkernel region with page granularity during
linear mapping.

With this change, the system can make use of block or section mapping
on linear region to largely improve perforcemence during system bootup
and running.
Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20230407011507.17572-3-bhe@redhat.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 0d124e96
...@@ -510,21 +510,6 @@ void __init mark_linear_text_alias_ro(void) ...@@ -510,21 +510,6 @@ void __init mark_linear_text_alias_ro(void)
PAGE_KERNEL_RO); PAGE_KERNEL_RO);
} }
static bool crash_mem_map __initdata;
static int __init enable_crash_mem_map(char *arg)
{
/*
* Proper parameter parsing is done by reserve_crashkernel(). We only
* need to know if the linear map has to avoid block mappings so that
* the crashkernel reservations can be unmapped later.
*/
crash_mem_map = true;
return 0;
}
early_param("crashkernel", enable_crash_mem_map);
static void __init map_mem(pgd_t *pgdp) static void __init map_mem(pgd_t *pgdp)
{ {
static const u64 direct_map_end = _PAGE_END(VA_BITS_MIN); static const u64 direct_map_end = _PAGE_END(VA_BITS_MIN);
...@@ -554,16 +539,6 @@ static void __init map_mem(pgd_t *pgdp) ...@@ -554,16 +539,6 @@ static void __init map_mem(pgd_t *pgdp)
*/ */
memblock_mark_nomap(kernel_start, kernel_end - kernel_start); memblock_mark_nomap(kernel_start, kernel_end - kernel_start);
#ifdef CONFIG_KEXEC_CORE
if (crash_mem_map) {
if (defer_reserve_crashkernel())
flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
else if (crashk_res.end)
memblock_mark_nomap(crashk_res.start,
resource_size(&crashk_res));
}
#endif
/* map all the memory banks */ /* map all the memory banks */
for_each_mem_range(i, &start, &end) { for_each_mem_range(i, &start, &end) {
if (start >= end) if (start >= end)
...@@ -590,24 +565,6 @@ static void __init map_mem(pgd_t *pgdp) ...@@ -590,24 +565,6 @@ static void __init map_mem(pgd_t *pgdp)
__map_memblock(pgdp, kernel_start, kernel_end, __map_memblock(pgdp, kernel_start, kernel_end,
PAGE_KERNEL, NO_CONT_MAPPINGS); PAGE_KERNEL, NO_CONT_MAPPINGS);
memblock_clear_nomap(kernel_start, kernel_end - kernel_start); memblock_clear_nomap(kernel_start, kernel_end - kernel_start);
/*
* Use page-level mappings here so that we can shrink the region
* in page granularity and put back unused memory to buddy system
* through /sys/kernel/kexec_crash_size interface.
*/
#ifdef CONFIG_KEXEC_CORE
if (crash_mem_map && !defer_reserve_crashkernel()) {
if (crashk_res.end) {
__map_memblock(pgdp, crashk_res.start,
crashk_res.end + 1,
PAGE_KERNEL,
NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS);
memblock_clear_nomap(crashk_res.start,
resource_size(&crashk_res));
}
}
#endif
} }
void mark_rodata_ro(void) void mark_rodata_ro(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment