powerpc/fadump: fadump fixes and improvements
cover powerpc/fadump: fadump fixes and improvements
This series fixes a couple of issues in fadump and improves logging. The first patch fixes a bug that is observed when memory reserved for fadump is not adjacent to boot memory area. The second patch ensures mmap read succeeds for all memory regions in the vmcore. The third patch improves the data that is printed for fadump.
Hari Bathini (3):
powerpc/fadump: fix PT_LOAD segment for boot memory area powerpc/fadump: align destination address to pagesize powerpc/fadump: print start of preserved area
arch/powerpc/kernel/fadump.c | 13 +++++++++++-- arch/powerpc/platforms/powernv/opal-fadump.c | 6 +++--- arch/powerpc/platforms/pseries/rtas-fadump.c | 12 +++++++++--- 3 files changed, 23 insertions(+), 8 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/3 powerpc/fadump: fix PT_LOAD segment for boot memory area
Boot memory area is setup as separate PT_LOAD segment in the vmcore as it is moved by f/w, on crash, to a destination address provided by the kernel. Having separate PT_LOAD segment helps in handling the different physical address and offset for boot memory area in the vmcore.
Commit ced1bf52f477 ("powerpc/fadump: merge adjacent memory ranges to reduce PT_LOAD segements") inadvertly broke this pre-condition for cases where some of the first kernel memory is available adjacent to boot memory area. This scenario is rare but possible when memory for fadump could not be reserved adjacent to boot memory area owing to memory hole or such. Reading memory from a vmcore exported in such scenario provides incorrect data. Fix it by ensuring no other region is folded into boot memory area.
--- arch/powerpc/kernel/fadump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/fadump.c +6 -2
@@ -867,7 +867,6 @@ static int fadump_alloc_mem_ranges(struct fadump_mrange_info *mrange_info) sizeof(struct fadump_memory_range));return 0 ; } -static inline int fadump_add_mem_range (struct fadump_mrange_info *mrange_info,u64 base,u64 end) {
@@ -886,7 +885,12 @@ static inline int fadump_add_mem_range(struct fadump_mrange_info *mrange_info, start = mem_ranges[mrange_info->mem_range_cnt -1 ].base; size = mem_ranges[mrange_info->mem_range_cnt -1 ].size; -if ((start + size) == base) +/* +* Boot memory area needs separate PT_LOAD segment(s) as it +* is moved to a different location at the time of crash. +* So, fold only if the region is not boot memory area. +*/ +if ((start + size) == base && start >= fw_dump.boot_mem_top) is_adjacent = true; }if (!is_adjacent) {
Signature · 1 line
2.35.1
PATCH 2/3 powerpc/fadump: align destination address to pagesize
In reply to Hari BathiniOn crash, boot memory area is copied to a destination address by f/w. This region is setup as separate PT_LOAD segment with appropriate offset to handle the different physical address and offset in vmcore. If this destination address is not page aligned, reading the vmcore with mmap is likely to fail forcing tools like makedumpfile to fall back to regular read. Avoid mmap read failure by ensuring that the destination address is always page aligned.
--- arch/powerpc/kernel/fadump.c | 5 +++++ arch/powerpc/platforms/pseries/rtas-fadump.c | 6 ++++++ 2 files changed, 11 insertions(+)
arch/powerpc/kernel/fadump.c +5 -0
@@ -365,6 +365,11 @@ static unsigned long __init get_fadump_area_size(void) size += fw_dump.cpu_state_data_size; size += fw_dump.hpte_region_size; +/* +* Account for pagesize alignment of boot memory area destination address. +* This faciliates in mmap reading of first kernel's memory. +*/ + size =PAGE_ALIGN (size); size += fw_dump.boot_memory_size; size +=sizeof (struct fadump_crash_info_header ); size +=sizeof (struct elfhdr );/* ELF core header.*/
arch/powerpc/platforms/pseries/rtas-fadump.c +6 -0
@@ -108,6 +108,12 @@ static u64 rtas_fadump_init_mem_struct(struct fw_dump *fadump_conf) fdm.hpte_region.destination_address =cpu_to_be64 (addr); addr += fadump_conf->hpte_region_size; +/* +* Align boot memory area destination address to page boundary to +* be able to mmap read this area in the vmcore. +*/ + addr =PAGE_ALIGN (addr); +/* RMA region section */ fdm.rmr_region.request_flag =cpu_to_be32 (RTAS_FADUMP_REQUEST_FLAG ); fdm.rmr_region.source_data_type =
Signature · 1 line
2.35.1
PATCH 3/3 powerpc/fadump: print start of preserved area
In reply to Hari BathiniPrint preserved area start address in fadump_region_show() function.
--- arch/powerpc/platforms/powernv/opal-fadump.c | 6 +++--- arch/powerpc/platforms/pseries/rtas-fadump.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/platforms/powernv/opal-fadump.c +3 -3
@@ -578,10 +578,10 @@ static void opal_fadump_region_show(struct fw_dump *fadump_conf, fdm_ptr->rgn[i].size, dumped_bytes); } -/* Dump is active. Show reserved area start address. */ +/* Dump is active. Show preserved area start address. */ if (fadump_conf->dump_active) { -seq_printf (m,"\nMemory above %#016lx is reserved for saving crash dump\n" , - fadump_conf->reserve_dump_area_start); +seq_printf (m,"\nMemory above %#016llx is reserved for saving crash dump\n" , + fadump_conf->boot_mem_top); } }
arch/powerpc/platforms/pseries/rtas-fadump.c +3 -3
@@ -468,10 +468,10 @@ static void rtas_fadump_region_show(struct fw_dump *fadump_conf,be64_to_cpu (fdm_ptr->rmr_region.source_len), be64_to_cpu(fdm_ptr->rmr_region.bytes_dumped)); -/* Dump is active. Show reserved area start address. */ +/* Dump is active. Show preserved area start address. */ if (fdm_active) { -seq_printf (m,"\nMemory above %#016lx is reserved for saving crash dump\n" , - fadump_conf->reserve_dump_area_start); +seq_printf (m,"\nMemory above %#016llx is reserved for saving crash dump\n" , + fadump_conf->boot_mem_top); } }
Signature · 1 line
2.35.1
Michael Ellerman
AppliedQuoted 6 lines · Hari Bathini
This series fixes a couple of issues in fadump and improves logging. The first patch fixes a bug that is observed when memory reserved for fadump is not adjacent to boot memory area. The second patch ensures mmap read succeeds for all memory regions in the vmcore. The third patch improves the data that is printed for fadump.
Quoted 6 lines
Hari Bathini (3):
powerpc/fadump: fixPT_LOADsegment for boot memory area powerpc/fadump: align destination address to pagesize powerpc/fadump: print start of preserved area[...]
Applied to powerpc/next.
[1/3] powerpc/fadump: fix PT_LOAD segment for boot memory area
https://git.kernel.org/powerpc/c/15eb77f873255cf9f4d703b63cfbd23c46579654 [2/3] powerpc/fadump: align destination address to pagesize https://git.kernel.org/powerpc/c/9cf3b3a33a36ef4a988be0a770edd3555297f2a9 [3/3] powerpc/fadump: print start of preserved area https://git.kernel.org/powerpc/c/a3ceb5882edf6696ebc6aeb8043ddec548a93052
cheers