Skip to contentSkip to conversation

makedumpfile: ppc64: get vmalloc start address from vmcoreinfo

PATCH In review Aditya Gupta 3 participants 7 messages Feb 23, 2024 – Mar 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 makedumpfile: ppc64: get vmalloc start address from vmcoreinfo

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

    ...
    Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000.
    [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, addr:c00c000000000000, size:16384
    [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't read the buffer of struct page.
    [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude unnecessary pages.
    [ 17.562632] kdump.sh[404]: The kernel version is not supported.
    [ 17.562708] kdump.sh[404]: The makedumpfile operation may be incomplete.
    [ 17.562773] kdump.sh[404]: makedumpfile Failed.
    [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

commit 378eb24a0658dd922b29524e0ce35c6c43f56cba
mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
1. Set vmalloc_start based on 'VMALLOC_START'
2. Don't error if vmap_area_list/vmlist are not defined

---
 arch/ppc64.c   | 19 +++++++++++++------
 makedumpfile.c |  3 ++-
 makedumpfile.h |  6 +++---
 3 files changed, 18 insertions(+), 10 deletions(-)
arch/ppc64.c +13 -6
index 96c357cb0335..bb62e2cd199a 100644
@@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
 	/*
 	 * Get vmalloc_start value from either vmap_area_list or vmlist.
 	 */
-	if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
+	if (NUMBER(vmalloc_start) != NOT_FOUND_SYMBOL) {
+		vmalloc_start = NUMBER(vmalloc_start);
+	} else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
 	    && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE)
 	    && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) {
 		if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next),
@@ -684,11 +686,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
 	if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
 	    || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
 	    || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
-		if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
-		    || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
-			ERRMSG("Can't get info for vmalloc translation.\n");
-			return NOT_PADDR;
-		}
+		/*
+		 * Don't depend on vmap_area_list/vmlist if vmalloc_start is set in
+		 * vmcoreinfo, in that case proceed without error
+		 */
+		if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
+			if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+				|| (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
+				ERRMSG("Can't get info for vmalloc translation.\n");
+				return NOT_PADDR;
+			}
 	}
 
 	return ppc64_vtop_level4(vaddr);
makedumpfile.c +2 -1
index b004b93fecb7..b6c63fad15f3 100644
@@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
 	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE);
 	READ_NUMBER("phys_base", phys_base);
 	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+
+	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
 #ifdef __aarch64__
 	READ_NUMBER("VA_BITS", VA_BITS);
 	READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
@@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
 	READ_NUMBER("VA_BITS", va_bits);
 	READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base);
 	READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset);
-	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
 	READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end);
 	READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start);
 	READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end);
makedumpfile.h +3 -3
index 59c83e1d9df3..4021c5af2a34 100644
@@ -541,8 +541,6 @@ do { \
  * The value of dependence on machine
  */
 #define PAGE_OFFSET		(info->page_offset)
-#define VMALLOC_START		(info->vmalloc_start)
-#define VMALLOC_END		(info->vmalloc_end)
 #define VMEMMAP_START		(info->vmemmap_start)
 #define VMEMMAP_END		(info->vmemmap_end)
 #define PMASK			(0x7ffffffffffff000UL)
@@ -2262,6 +2260,9 @@ struct number_table {
 	long    HUGETLB_PAGE_DTOR;
 	long	phys_base;
 	long	KERNEL_IMAGE_SIZE;
+
+	unsigned long vmalloc_start;
+
 #ifdef __aarch64__
 	long 	VA_BITS;
 	long	TCR_EL1_T1SZ;
@@ -2272,7 +2273,6 @@ struct number_table {
 	long va_bits;
 	unsigned long phys_ram_base;
 	unsigned long page_offset;
-	unsigned long vmalloc_start;
 	unsigned long vmalloc_end;
 	unsigned long vmemmap_start;
 	unsigned long vmemmap_end;
Signature · 7 lines
2.43.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Tested-by on v1 1/1
#1 lore raw
Quoted 28 lines · Aditya Gupta

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

   ...
   Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000.
   [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, addr:c00c000000000000, size:16384
   [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't read the buffer of struct page.
   [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude unnecessary pages.
   [ 17.562632] kdump.sh[404]: The kernel version is not supported.
   [ 17.562708] kdump.sh[404]: The makedumpfile operation may be incomplete.
   [ 17.562773] kdump.sh[404]: makedumpfile Failed.
   [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

commit 378eb24a0658dd922b29524e0ce35c6c43f56cba
mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Quoted 7 lines

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
1. Set vmalloc_start based on 'VMALLOC_START'
2. Don't error if vmap_area_list/vmlist are not defined

---

Thanks Aditya for the fix. With this fix applied makedumpfile is able to save vmcore during kdump.

- Sachin
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
In reply to Aditya Gupta

Hi Aditya,

thanks for the patch.

Quoted 41 lines · Aditya Gupta

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

     ...
     Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000.
     [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, addr:c00c000000000000, size:16384
     [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't read the buffer of struct page.
     [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude unnecessary pages.
     [ 17.562632] kdump.sh[404]: The kernel version is not supported.
     [ 17.562708] kdump.sh[404]: The makedumpfile operation may be incomplete.
     [ 17.562773] kdump.sh[404]: makedumpfile Failed.
     [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

commit 378eb24a0658dd922b29524e0ce35c6c43f56cba
mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
1. Set vmalloc_start based on 'VMALLOC_START'
2. Don't error if vmap_area_list/vmlist are not defined

---
  arch/ppc64.c   | 19 +++++++++++++------
  makedumpfile.c |  3 ++-
  makedumpfile.h |  6 +++---
  3 files changed, 18 insertions(+), 10 deletions(-)
arch/ppc64.c +0 -0
index 96c357cb0335..bb62e2cd199a 100644

arch/ppc64.c get_machdep_info_ppc64(void) · line 571

Quoted 5 lines
arch/ppc64.c +1 -1
@@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
  	/*
  	 * Get vmalloc_start value from either vmap_area_list or vmlist.
  	 */
-	if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
+	if (NUMBER(vmalloc_start) != NOT_FOUND_SYMBOL) {

I will fix this NOT_FOUND_SYMBOL to NOT_FOUND_NUMBER when applying, otherwise makedumpfile will fail for a dumpfile without the corresponding kernel patch, correct?

The patch looks good to me except for it. I will apply this with the kernel version in the commit log after the kernel patch gets merged.

Thanks,
Kazu

Quoted 72 lines
arch/ppc64.c +12 -5
+		vmalloc_start = NUMBER(vmalloc_start);
+	} else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
  	    && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE)
  	    && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) {
  		if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next),
@@ -684,11 +686,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
  	if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
  	    || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
  	    || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
-		if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
-		    || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
-			ERRMSG("Can't get info for vmalloc translation.\n");
-			return NOT_PADDR;
-		}
+		/*
+		 * Don't depend on vmap_area_list/vmlist if vmalloc_start is set in
+		 * vmcoreinfo, in that case proceed without error
+		 */
+		if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
+			if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+				|| (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
+				ERRMSG("Can't get info for vmalloc translation.\n");
+				return NOT_PADDR;
+			}
  	}
 
  	return ppc64_vtop_level4(vaddr);
makedumpfile.c +2 -1
index b004b93fecb7..b6c63fad15f3 100644
@@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
  	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE);
  	READ_NUMBER("phys_base", phys_base);
  	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+
+	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
  #ifdef __aarch64__
  	READ_NUMBER("VA_BITS", VA_BITS);
  	READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
@@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
  	READ_NUMBER("VA_BITS", va_bits);
  	READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base);
  	READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset);
-	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
  	READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end);
  	READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start);
  	READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end);
makedumpfile.h +3 -2
index 59c83e1d9df3..4021c5af2a34 100644
@@ -541,8 +541,6 @@ do { \
   * The value of dependence on machine
   */
  #define PAGE_OFFSET		(info->page_offset)
-#define VMALLOC_START		(info->vmalloc_start)
-#define VMALLOC_END		(info->vmalloc_end)
  #define VMEMMAP_START		(info->vmemmap_start)
  #define VMEMMAP_END		(info->vmemmap_end)
  #define PMASK			(0x7ffffffffffff000UL)
@@ -2262,6 +2260,9 @@ struct number_table {
  	long    HUGETLB_PAGE_DTOR;
  	long	phys_base;
  	long	KERNEL_IMAGE_SIZE;
+
+	unsigned long vmalloc_start;
+
  #ifdef __aarch64__
  	long 	VA_BITS;
  	long	TCR_EL1_T1SZ;

makedumpfile.h struct number_table { · line 2278

Quoted 7 lines
makedumpfile.h +0 -1
@@ -2272,7 +2273,6 @@ struct number_table {
  	long va_bits;
  	unsigned long phys_ram_base;
  	unsigned long page_offset;
-	unsigned long vmalloc_start;
  	unsigned long vmalloc_end;
  	unsigned long vmemmap_start;
  	unsigned long vmemmap_end;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

Hi Kazu,

Quoted 56 lines · HAGIO KAZUHITO(萩尾 一仁)

Hi Aditya,

thanks for the patch.

Quoted 41 lines · Aditya Gupta

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

     ...
     Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000.
     [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, addr:c00c000000000000, size:16384
     [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't read the buffer of struct page.
     [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude unnecessary pages.
     [ 17.562632] kdump.sh[404]: The kernel version is not supported.
     [ 17.562708] kdump.sh[404]: The makedumpfile operation may be incomplete.
     [ 17.562773] kdump.sh[404]: makedumpfile Failed.
     [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

commit 378eb24a0658dd922b29524e0ce35c6c43f56cba
mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
1. Set vmalloc_start based on 'VMALLOC_START'
2. Don't error if vmap_area_list/vmlist are not defined

---
  arch/ppc64.c   | 19 +++++++++++++------
  makedumpfile.c |  3 ++-
  makedumpfile.h |  6 +++---
  3 files changed, 18 insertions(+), 10 deletions(-)
arch/ppc64.c +0 -0
index 96c357cb0335..bb62e2cd199a 100644

arch/ppc64.c get_machdep_info_ppc64(void) · line 571

Quoted 5 lines
arch/ppc64.c +1 -1
@@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
  	/*
  	 * Get vmalloc_start value from either vmap_area_list or vmlist.
  	 */
-	if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
+	if (NUMBER(vmalloc_start) != NOT_FOUND_SYMBOL) {

I will fix this NOT_FOUND_SYMBOL to NOT_FOUND_NUMBER when applying, otherwise makedumpfile will fail for a dumpfile without the corresponding kernel patch, correct?

Quoted 2 lines

The patch looks good to me except for it. I will apply this with the kernel version in the commit log after the kernel patch gets merged.

Sure, thanks Kazu. I just ran it on an older version, it succeeds collecting dump on 6.5.0 kernel somehow, though I agree with your suggestion, it should have been NOT_FOUND_NUMBER. I will be more careful about these things later.

Thanks,
Aditya Gupta

Quoted 76 lines

Thanks,
Kazu

Quoted 71 lines
arch/ppc64.c +12 -5
+		vmalloc_start = NUMBER(vmalloc_start);
+	} else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
  	    && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE)
  	    && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) {
  		if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next),
@@ -684,11 +686,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
  	if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
  	    || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
  	    || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
-		if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
-		    || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
-			ERRMSG("Can't get info for vmalloc translation.\n");
-			return NOT_PADDR;
-		}
+		/*
+		 * Don't depend on vmap_area_list/vmlist if vmalloc_start is set in
+		 * vmcoreinfo, in that case proceed without error
+		 */
+		if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
+			if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+				|| (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
+				ERRMSG("Can't get info for vmalloc translation.\n");
+				return NOT_PADDR;
+			}
  	}
 
  	return ppc64_vtop_level4(vaddr);
makedumpfile.c +2 -1
index b004b93fecb7..b6c63fad15f3 100644
@@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
  	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE);
  	READ_NUMBER("phys_base", phys_base);
  	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+
+	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
  #ifdef __aarch64__
  	READ_NUMBER("VA_BITS", VA_BITS);
  	READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
@@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
  	READ_NUMBER("VA_BITS", va_bits);
  	READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base);
  	READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset);
-	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
  	READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end);
  	READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start);
  	READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end);
makedumpfile.h +3 -2
index 59c83e1d9df3..4021c5af2a34 100644
@@ -541,8 +541,6 @@ do { \
   * The value of dependence on machine
   */
  #define PAGE_OFFSET		(info->page_offset)
-#define VMALLOC_START		(info->vmalloc_start)
-#define VMALLOC_END		(info->vmalloc_end)
  #define VMEMMAP_START		(info->vmemmap_start)
  #define VMEMMAP_END		(info->vmemmap_end)
  #define PMASK			(0x7ffffffffffff000UL)
@@ -2262,6 +2260,9 @@ struct number_table {
  	long    HUGETLB_PAGE_DTOR;
  	long	phys_base;
  	long	KERNEL_IMAGE_SIZE;
+
+	unsigned long vmalloc_start;
+
  #ifdef __aarch64__
  	long 	VA_BITS;
  	long	TCR_EL1_T1SZ;
Quoted 8 lines

makedumpfile.h struct number_table { · line 2278

Quoted 8 lines
makedumpfile.h +0 -1
@@ -2272,7 +2273,6 @@ struct number_table {
  	long va_bits;
  	unsigned long phys_ram_base;
  	unsigned long page_offset;
-	unsigned long vmalloc_start;
  	unsigned long vmalloc_end;
  	unsigned long vmemmap_start;
  	unsigned long vmemmap_end;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
In reply to Aditya Gupta

Hi,
The commit removing 'vmap_area_list' is now merged in Linux mainline tree.
    commit:     55c49fee57af99f3c663e69dedc5b85e691bbe50 mm/vmalloc: remove vmap_area_list

Any comments on this patch ?

Thanks,

Aditya Gupta

Quoted 118 lines · Aditya Gupta

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

     ...
     Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000.
     [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, addr:c00c000000000000, size:16384
     [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't read the buffer of struct page.
     [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude unnecessary pages.
     [ 17.562632] kdump.sh[404]: The kernel version is not supported.
     [ 17.562708] kdump.sh[404]: The makedumpfile operation may be incomplete.
     [ 17.562773] kdump.sh[404]: makedumpfile Failed.
     [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

commit 378eb24a0658dd922b29524e0ce35c6c43f56cba
mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
1. Set vmalloc_start based on 'VMALLOC_START'
2. Don't error if vmap_area_list/vmlist are not defined

---
  arch/ppc64.c   | 19 +++++++++++++------
  makedumpfile.c |  3 ++-
  makedumpfile.h |  6 +++---
  3 files changed, 18 insertions(+), 10 deletions(-)
arch/ppc64.c +13 -6
index 96c357cb0335..bb62e2cd199a 100644
@@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
  	/*
  	 * Get vmalloc_start value from either vmap_area_list or vmlist.
  	 */
-	if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
+	if (NUMBER(vmalloc_start) != NOT_FOUND_SYMBOL) {
+		vmalloc_start = NUMBER(vmalloc_start);
+	} else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
  	    && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE)
  	    && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) {
  		if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next),
@@ -684,11 +686,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
  	if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
  	    || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
  	    || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
-		if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
-		    || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
-			ERRMSG("Can't get info for vmalloc translation.\n");
-			return NOT_PADDR;
-		}
+		/*
+		 * Don't depend on vmap_area_list/vmlist if vmalloc_start is set in
+		 * vmcoreinfo, in that case proceed without error
+		 */
+		if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
+			if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+				|| (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
+				ERRMSG("Can't get info for vmalloc translation.\n");
+				return NOT_PADDR;
+			}
  	}
 
  	return ppc64_vtop_level4(vaddr);
makedumpfile.c +2 -1
index b004b93fecb7..b6c63fad15f3 100644
@@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
  	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE);
  	READ_NUMBER("phys_base", phys_base);
  	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+
+	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
  #ifdef __aarch64__
  	READ_NUMBER("VA_BITS", VA_BITS);
  	READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
@@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
  	READ_NUMBER("VA_BITS", va_bits);
  	READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base);
  	READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset);
-	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
  	READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end);
  	READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start);
  	READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end);
makedumpfile.h +3 -2
index 59c83e1d9df3..4021c5af2a34 100644
@@ -541,8 +541,6 @@ do { \
   * The value of dependence on machine
   */
  #define PAGE_OFFSET		(info->page_offset)
-#define VMALLOC_START		(info->vmalloc_start)
-#define VMALLOC_END		(info->vmalloc_end)
  #define VMEMMAP_START		(info->vmemmap_start)
  #define VMEMMAP_END		(info->vmemmap_end)
  #define PMASK			(0x7ffffffffffff000UL)
@@ -2262,6 +2260,9 @@ struct number_table {
  	long    HUGETLB_PAGE_DTOR;
  	long	phys_base;
  	long	KERNEL_IMAGE_SIZE;
+
+	unsigned long vmalloc_start;
+
  #ifdef __aarch64__
  	long 	VA_BITS;
  	long	TCR_EL1_T1SZ;

makedumpfile.h struct number_table { · line 2278

Quoted 7 lines
makedumpfile.h +0 -1
@@ -2272,7 +2273,6 @@ struct number_table {
  	long va_bits;
  	unsigned long phys_ram_base;
  	unsigned long page_offset;
-	unsigned long vmalloc_start;
  	unsigned long vmalloc_end;
  	unsigned long vmemmap_start;
  	unsigned long vmemmap_end;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw
Quoted 4 lines · Aditya Gupta

Hi,
The commit removing 'vmap_area_list' is now merged in Linux mainline tree.
    commit:     55c49fee57af99f3c663e69dedc5b85e691bbe50 mm/vmalloc: remove vmap_area_list

Applied with this commit id and the fix.
https://github.com/makedumpfile/makedumpfile/commit/94241fd2feed059227a243618f2acc6aabf366e8

Thanks,
Kazu

Quoted 133 lines

Any comments on this patch ?

Thanks,

Aditya Gupta

Quoted 125 lines · Aditya Gupta

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

     ...
     Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000.

     [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, 
addr:c00c000000000000, size:16384
     [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't 
read the buffer of struct page.
     [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude 
unnecessary pages.
     [ 17.562632] kdump.sh[404]: The kernel version is not supported.
     [ 17.562708] kdump.sh[404]: The makedumpfile operation may be 
incomplete.
     [ 17.562773] kdump.sh[404]: makedumpfile Failed.
     [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

     commit 378eb24a0658dd922b29524e0ce35c6c43f56cba mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
   1. Set vmalloc_start based on 'VMALLOC_START'
   2. Don't error if vmap_area_list/vmlist are not defined

---
  arch/ppc64.c   | 19 +++++++++++++------
  makedumpfile.c |  3 ++-
  makedumpfile.h |  6 +++---

  3 files changed, 18 insertions(+), 10 deletions(-)
arch/ppc64.c +3 -1
index 96c357cb0335..bb62e2cd199a 100644
@@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
       /*
        * Get vmalloc_start value from either vmap_area_list or vmlist.
        */
-    if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
+    if (NUMBER(vmalloc_start) != NOT_FOUND_SYMBOL) {
+        vmalloc_start = NUMBER(vmalloc_start);
+    } else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
           && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE)
           && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) {

          if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next),

arch/ppc64.c +2 -5
@@ -684,11 +686,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
       if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
           || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
           || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
-        if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
-            || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
-            ERRMSG("Can't get info for vmalloc translation.\n");
-            return NOT_PADDR;
-        }
+        /*
+         * Don't depend on vmap_area_list/vmlist if vmalloc_start is 

set in
+         * vmcoreinfo, in that case proceed without error +         */
+        if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
+            if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+                || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) { +                ERRMSG("Can't get info for vmalloc translation.\n"); +                return NOT_PADDR;
+            }
      }
      return ppc64_vtop_level4(vaddr);

makedumpfile.c +2 -0
index b004b93fecb7..b6c63fad15f3 100644
@@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
       READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", 
 PAGE_OFFLINE_MAPCOUNT_VALUE);
       READ_NUMBER("phys_base", phys_base);
       READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+
+    READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
   #ifdef __aarch64__
       READ_NUMBER("VA_BITS", VA_BITS);

      READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);

makedumpfile.c +0 -1
@@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
       READ_NUMBER("VA_BITS", va_bits);
       READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base);
       READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset);
-    READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
       READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end);
       READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start);
       READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end);
makedumpfile.h +3 -2
index 59c83e1d9df3..4021c5af2a34 100644
@@ -541,8 +541,6 @@ do { \
    * The value of dependence on machine
    */
   #define PAGE_OFFSET        (info->page_offset)
-#define VMALLOC_START        (info->vmalloc_start)
-#define VMALLOC_END        (info->vmalloc_end)
   #define VMEMMAP_START        (info->vmemmap_start)
   #define VMEMMAP_END        (info->vmemmap_end)
   #define PMASK            (0x7ffffffffffff000UL)
@@ -2262,6 +2260,9 @@ struct number_table {
       long    HUGETLB_PAGE_DTOR;
       long    phys_base;
       long    KERNEL_IMAGE_SIZE;
+
+    unsigned long vmalloc_start;
+
   #ifdef __aarch64__
       long     VA_BITS;
       long    TCR_EL1_T1SZ;
Quoted 8 lines

makedumpfile.h struct number_table { · line 2278

Quoted 8 lines
makedumpfile.h +0 -1
@@ -2272,7 +2273,6 @@ struct number_table {
       long va_bits;
       unsigned long phys_ram_base;
       unsigned long page_offset;
-    unsigned long vmalloc_start;
       unsigned long vmalloc_end;
       unsigned long vmemmap_start;
       unsigned long vmemmap_end;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#6 lore raw
Quoted 7 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 4 lines · Aditya Gupta

Hi,
The commit removing 'vmap_area_list' is now merged in Linux mainline tree.
    commit:     55c49fee57af99f3c663e69dedc5b85e691bbe50 mm/vmalloc: remove vmap_area_list

Applied with this commit id and the fix.
https://github.com/makedumpfile/makedumpfile/commit/94241fd2feed059227a243618f2acc6aabf366e8

Thanks Kazu.

- Aditya Gupta

Quoted 135 lines

Thanks,
Kazu

Quoted 132 lines

Any comments on this patch ?

Thanks,

Aditya Gupta

Quoted 125 lines · Aditya Gupta

Below error was noticed when running makedumpfile on linux-next kernel crash (linux-next tag next-20240121):

     ...
     Checking for memory holes : [100.0 %] | readpage_elf: Attempt to
read non-existent page at 0xc000000000000.

      [ 17.551718] kdump.sh[404]: readmem: type_addr: 0,
addr:c00c000000000000, size:16384
      [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't
read the buffer of struct page.
      [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude
unnecessary pages.
      [ 17.562632] kdump.sh[404]: The kernel version is not supported.
      [ 17.562708] kdump.sh[404]: The makedumpfile operation may be
incomplete.
      [ 17.562773] kdump.sh[404]: makedumpfile Failed.
      [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1

Above error was due to 'vmap_area_list' and 'vmlist' symbols missing from the vmcore.

'vmap_area_list' was removed in the linux kernel with below commit:

     commit 378eb24a0658dd922b29524e0ce35c6c43f56cba mm/vmalloc: remove vmap_area_list

Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to get base address of vmalloc area, instead of depending on 'vmap_area_list'

Hence if 'VMALLOC_START' symbol is there in vmcoreinfo:
   1. Set vmalloc_start based on 'VMALLOC_START'
   2. Don't error if vmap_area_list/vmlist are not defined

---
   arch/ppc64.c   | 19 +++++++++++++------
   makedumpfile.c |  3 ++-
   makedumpfile.h |  6 +++---
   3 files changed, 18 insertions(+), 10 deletions(-)
arch/ppc64.c +3 -1
index 96c357cb0335..bb62e2cd199a 100644
@@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
       /*
        * Get vmalloc_start value from either vmap_area_list or vmlist.
        */
-    if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
+    if (NUMBER(vmalloc_start) != NOT_FOUND_SYMBOL) {
+        vmalloc_start = NUMBER(vmalloc_start);
+    } else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
           && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE)
           && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) {
           if (!readmem(VADDR, SYMBOL(vmap_area_list) +

OFFSET(list_head.next),

arch/ppc64.c +2 -5
@@ -684,11 +686,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
       if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
           || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
           || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
-        if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
-            || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
-            ERRMSG("Can't get info for vmalloc translation.\n");
-            return NOT_PADDR;
-        }
+        /*
+         * Don't depend on vmap_area_list/vmlist if vmalloc_start is

set in
+         * vmcoreinfo, in that case proceed without error +         */
+        if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
+            if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+                || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) { +                ERRMSG("Can't get info for vmalloc translation.\n"); +                return NOT_PADDR;
+            }
      }
      return ppc64_vtop_level4(vaddr);

makedumpfile.c +2 -0
index b004b93fecb7..b6c63fad15f3 100644
@@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
       READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE",
 PAGE_OFFLINE_MAPCOUNT_VALUE);
       READ_NUMBER("phys_base", phys_base);
       READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
+
+    READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
   #ifdef __aarch64__
       READ_NUMBER("VA_BITS", VA_BITS);

      READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);

makedumpfile.c +0 -1
@@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
       READ_NUMBER("VA_BITS", va_bits);
       READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base);
       READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset);
-    READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
       READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end);
       READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start);
       READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end);
makedumpfile.h +3 -2
index 59c83e1d9df3..4021c5af2a34 100644
@@ -541,8 +541,6 @@ do { \
    * The value of dependence on machine
    */
   #define PAGE_OFFSET        (info->page_offset)
-#define VMALLOC_START        (info->vmalloc_start)
-#define VMALLOC_END        (info->vmalloc_end)
   #define VMEMMAP_START        (info->vmemmap_start)
   #define VMEMMAP_END        (info->vmemmap_end)
   #define PMASK            (0x7ffffffffffff000UL)
@@ -2262,6 +2260,9 @@ struct number_table {
       long    HUGETLB_PAGE_DTOR;
       long    phys_base;
       long    KERNEL_IMAGE_SIZE;
+
+    unsigned long vmalloc_start;
+
   #ifdef __aarch64__
       long     VA_BITS;
       long    TCR_EL1_T1SZ;
Quoted 8 lines
Quoted 8 lines

makedumpfile.h struct number_table { · line 2278

Quoted 8 lines
makedumpfile.h +0 -1
@@ -2272,7 +2273,6 @@ struct number_table {
       long va_bits;
       unsigned long phys_ram_base;
       unsigned long page_offset;
-    unsigned long vmalloc_start;
       unsigned long vmalloc_end;
       unsigned long vmemmap_start;
       unsigned long vmemmap_end;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec