For pmem, metadata is specific to the namespace rather than the entire pmem region. Therefore, ranges that have not yet created a namespace or are unusable due to alignment reasons will not be associated with metadata. When an application attempts to access regions that do not have corresponding metadata, it will encounter an access error. With this flag, the dumping applications are able to know this access error, and then take special actions correspondingly. This is kexec_file_load() specific, for the traditional kexec_load(), kexec-tools will have a similar change. CC: Eric Biederman <ebiederm@xxxxxxxxxxxx> CC: Baoquan He <bhe@xxxxxxxxxx> CC: kexec@xxxxxxxxxxxxxxxxxxx Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx> --- kernel/kexec_file.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index f989f5f1933b..0d5b516b96ee 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -29,6 +29,8 @@ #include <linux/vmalloc.h> #include "kexec_internal.h" +#define PF_DEV (1 << 4) + #ifdef CONFIG_KEXEC_SIG static bool sig_enforce = IS_ENABLED(CONFIG_KEXEC_SIG_FORCE); @@ -1221,6 +1223,12 @@ int crash_exclude_mem_range(struct crash_mem *mem, return 0; } +static bool is_pmem_range(u64 start, u64 size) +{ + return REGION_INTERSECTS == region_intersects(start, size, + IORESOURCE_MEM, IORES_DESC_PERSISTENT_MEMORY); +} + int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, void **addr, unsigned long *sz) { @@ -1302,6 +1310,8 @@ int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, phdr->p_type = PT_LOAD; phdr->p_flags = PF_R|PF_W|PF_X; + if (is_pmem_range(mstart, mend - mstart)) + phdr->p_flags |= PF_DEV; phdr->p_offset = mstart; phdr->p_paddr = mstart; -- 2.29.2 _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec