提交 ebe315a0 编写于 作者: Z Zhen Lei 提交者: Zheng Zengkai

arm64: kdump: Try not to use NO_BLOCK_MAPPINGS for memory under 4G

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I545H8
CVE: NA

-------------------------------------------------------------------------

For the case crashkernel=X@offset and crashkernel=X,high, we've explicitly
used 'crashk_res' to mark the scope of the page-level mapping required, so
NO_BLOCK_MAPPINGS should not be required for other areas. Otherwise,
system performance will be affected. In fact, only the case crashkernel=X
requires page-level mapping for all low memory under 4G because it
attempts high memory after it fails to request low memory first, and we
cannot predict its final location.
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 fa1b3019
...@@ -97,6 +97,8 @@ static inline void crash_prepare_suspend(void) {} ...@@ -97,6 +97,8 @@ static inline void crash_prepare_suspend(void) {}
static inline void crash_post_resume(void) {} static inline void crash_post_resume(void) {}
#endif #endif
extern bool crash_low_mem_page_map;
#ifdef CONFIG_KEXEC_CORE #ifdef CONFIG_KEXEC_CORE
extern void __init reserve_crashkernel(void); extern void __init reserve_crashkernel(void);
extern void __init reserve_crashkernel_high(void); extern void __init reserve_crashkernel_high(void);
......
...@@ -469,21 +469,6 @@ void __init mark_linear_text_alias_ro(void) ...@@ -469,21 +469,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)
{ {
phys_addr_t kernel_start = __pa_symbol(_text); phys_addr_t kernel_start = __pa_symbol(_text);
...@@ -504,7 +489,7 @@ static void __init map_mem(pgd_t *pgdp) ...@@ -504,7 +489,7 @@ 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 #ifdef CONFIG_KEXEC_CORE
if (crash_mem_map) if (crash_low_mem_page_map)
eflags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; eflags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
if (crashk_res.end) if (crashk_res.end)
......
...@@ -321,6 +321,7 @@ int __init parse_crashkernel_low(char *cmdline, ...@@ -321,6 +321,7 @@ int __init parse_crashkernel_low(char *cmdline,
*/ */
#ifdef CONFIG_ARCH_WANT_RESERVE_CRASH_KERNEL #ifdef CONFIG_ARCH_WANT_RESERVE_CRASH_KERNEL
bool crash_low_mem_page_map __initdata;
static bool crash_high_mem_reserved __initdata; static bool crash_high_mem_reserved __initdata;
static struct resource crashk_res_high; static struct resource crashk_res_high;
...@@ -393,6 +394,8 @@ void __init reserve_crashkernel_high(void) ...@@ -393,6 +394,8 @@ void __init reserve_crashkernel_high(void)
ret = parse_crashkernel_high(cmdline, 0, &crash_size, &crash_base); ret = parse_crashkernel_high(cmdline, 0, &crash_size, &crash_base);
if (ret || !crash_size) if (ret || !crash_size)
return; return;
} else if (!crash_base) {
crash_low_mem_page_map = true;
} }
crash_size = PAGE_ALIGN(crash_size); crash_size = PAGE_ALIGN(crash_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册