Skip to contentSkip to conversation

Fix vmcoreinfo generation on 32bit hosts for 64bit kernels

PATCH In review Bernhard Walle 2 participants 5 messages Jun 26, 2008 – Jun 30, 2008

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

PATCH 1/1 Fix vmcoreinfo generation on 32bit hosts for 64bit kernels

This bug fixes the generation of vmcoreinfo files on 32bit hosts for ELF64 files, i.e. 64bit kernels. The concrete problem was PPC64 which is built in a 32bit environment at SUSE.

---
 makedumpfile.c |   37 ++++++++++++++++++-----------------
 makedumpfile.h |   60 ++++++++++++++++++++++++++++-----------------------------
 2 files changed, 49 insertions(+), 48 deletions(-)
makedumpfile.c +19 -18
@@ -123,7 +123,7 @@ vaddr_to_offset_general(unsigned long lo
  * It is useful at few calls like get_str_osrelease_from_vmlinux().
  */
 off_t
-vaddr_to_offset_slow(int fd, char *filename, unsigned long vaddr)
+vaddr_to_offset_slow(int fd, char *filename, unsigned long long vaddr)
 {
 	off_t offset = 0;
 	int i, phnum, num_load, flag_elf64, elf_format;
@@ -170,6 +170,7 @@ vaddr_to_offset_slow(int fd, char *filen
 			break;
 		}
 	}
+
 	return offset;
 }
 
@@ -970,11 +971,11 @@ out:
 	return ret;
 }
 
-unsigned long
+unsigned long long
 get_symbol_addr(char *symname)
 {
 	int i;
-	unsigned long symbol = NOT_FOUND_SYMBOL;
+	unsigned long long symbol = NOT_FOUND_SYMBOL;
 	Elf *elfd = NULL;
 	GElf_Shdr shdr;
 	GElf_Sym sym;
@@ -1949,7 +1950,7 @@ int
 get_str_osrelease_from_vmlinux()
 {
 	struct utsname system_utsname;
-	unsigned long utsname;
+	unsigned long long utsname;
 	off_t offset;
 	const off_t failed = (off_t)-1;
 
@@ -1968,7 +1969,7 @@ get_str_osrelease_from_vmlinux()
 	    dwarf_info.name_debuginfo, utsname);
 
 	if (!offset) {
-		ERRMSG("Can't convert vaddr (%lx) of utsname to an offset.\n",
+		ERRMSG("Can't convert vaddr (%llx) of utsname to an offset.\n",
 		    utsname);
 		return FALSE;
 	}
@@ -5684,19 +5685,19 @@ show_data_xen()
 	 * Show data for debug
 	 */
 	MSG("\n");
-	MSG("SYMBOL(dom_xen): %lx\n", SYMBOL(dom_xen));
-	MSG("SYMBOL(dom_io): %lx\n", SYMBOL(dom_io));
-	MSG("SYMBOL(domain_list): %lx\n", SYMBOL(domain_list));
-	MSG("SYMBOL(xen_heap_start): %lx\n", SYMBOL(xen_heap_start));
-	MSG("SYMBOL(frame_table): %lx\n", SYMBOL(frame_table));
-	MSG("SYMBOL(alloc_bitmap): %lx\n", SYMBOL(alloc_bitmap));
-	MSG("SYMBOL(max_page): %lx\n", SYMBOL(max_page));
-	MSG("SYMBOL(pgd_l2): %lx\n", SYMBOL(pgd_l2));
-	MSG("SYMBOL(pgd_l3): %lx\n", SYMBOL(pgd_l3));
-	MSG("SYMBOL(pgd_l4): %lx\n", SYMBOL(pgd_l4));
-	MSG("SYMBOL(xenheap_phys_end): %lx\n", SYMBOL(xenheap_phys_end));
-	MSG("SYMBOL(xen_pstart): %lx\n", SYMBOL(xen_pstart));
-	MSG("SYMBOL(frametable_pg_dir): %lx\n", SYMBOL(frametable_pg_dir));
+	MSG("SYMBOL(dom_xen): %llx\n", SYMBOL(dom_xen));
+	MSG("SYMBOL(dom_io): %llx\n", SYMBOL(dom_io));
+	MSG("SYMBOL(domain_list): %llx\n", SYMBOL(domain_list));
+	MSG("SYMBOL(xen_heap_start): %llx\n", SYMBOL(xen_heap_start));
+	MSG("SYMBOL(frame_table): %llx\n", SYMBOL(frame_table));
+	MSG("SYMBOL(alloc_bitmap): %llx\n", SYMBOL(alloc_bitmap));
+	MSG("SYMBOL(max_page): %llx\n", SYMBOL(max_page));
+	MSG("SYMBOL(pgd_l2): %llx\n", SYMBOL(pgd_l2));
+	MSG("SYMBOL(pgd_l3): %llx\n", SYMBOL(pgd_l3));
+	MSG("SYMBOL(pgd_l4): %llx\n", SYMBOL(pgd_l4));
+	MSG("SYMBOL(xenheap_phys_end): %llx\n", SYMBOL(xenheap_phys_end));
+	MSG("SYMBOL(xen_pstart): %llx\n", SYMBOL(xen_pstart));
+	MSG("SYMBOL(frametable_pg_dir): %llx\n", SYMBOL(frametable_pg_dir));
 
 	MSG("SIZE(page_info): %ld\n", SIZE(page_info));
 	MSG("OFFSET(page_info.count_info): %ld\n", OFFSET(page_info.count_info));
makedumpfile.h +30 -30

76 lines not on this page · raw message

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

#1 lore raw

Hi Bernhard,

Thank you for the patch.

Quoted 3 lines · Bernhard Walle

This bug fixes the generation of vmcoreinfo files on 32bit hosts for ELF64 files, i.e. 64bit kernels. The concrete problem was PPC64 which is built in a 32bit environment at SUSE.

I have one question.
I guess that the fundamental problem is that makedumpfile cannot use vmcoreinfo which is contained in /proc/vmcore on ppc64, right ? If yes, could you please test my attached patch for fixing it.

I created the kernel patch for adding the symbol "node_data" to ppc64's vmcoreinfo, but I cannot tested it because I don't have any ppc64 machine.

Thanks
Ken'ichi Ohmichi

arch/powerpc/kernel/machine_kexec.c renamed from arch/powerpc/kernel/machine_kexec.c.orig +10 -0
@@ -116,3 +116,13 @@ int overlaps_crashkernel(unsigned long s
 {
 	return (start + size) > crashk_res.start && start <= crashk_res.end;
 }
+
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_NUMA
+	VMCOREINFO_SYMBOL(node_data);
+	VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
+#endif
+}
+
Quoted 162 lines
---
 makedumpfile.c |   37 ++++++++++++++++++-----------------
 makedumpfile.h |   60 ++++++++++++++++++++++++++++-----------------------------
 2 files changed, 49 insertions(+), 48 deletions(-)
makedumpfile.c +19 -18
@@ -123,7 +123,7 @@ vaddr_to_offset_general(unsigned long lo
  * It is useful at few calls like get_str_osrelease_from_vmlinux().
  */
 off_t
-vaddr_to_offset_slow(int fd, char *filename, unsigned long vaddr)
+vaddr_to_offset_slow(int fd, char *filename, unsigned long long vaddr)
 {
 	off_t offset = 0;
 	int i, phnum, num_load, flag_elf64, elf_format;
@@ -170,6 +170,7 @@ vaddr_to_offset_slow(int fd, char *filen
 			break;
 		}
 	}
+
 	return offset;
 }
 
@@ -970,11 +971,11 @@ out:
 	return ret;
 }
 
-unsigned long
+unsigned long long
 get_symbol_addr(char *symname)
 {
 	int i;
-	unsigned long symbol = NOT_FOUND_SYMBOL;
+	unsigned long long symbol = NOT_FOUND_SYMBOL;
 	Elf *elfd = NULL;
 	GElf_Shdr shdr;
 	GElf_Sym sym;
@@ -1949,7 +1950,7 @@ int
 get_str_osrelease_from_vmlinux()
 {
 	struct utsname system_utsname;
-	unsigned long utsname;
+	unsigned long long utsname;
 	off_t offset;
 	const off_t failed = (off_t)-1;
 
@@ -1968,7 +1969,7 @@ get_str_osrelease_from_vmlinux()
 	    dwarf_info.name_debuginfo, utsname);
 
 	if (!offset) {
-		ERRMSG("Can't convert vaddr (%lx) of utsname to an offset.\n",
+		ERRMSG("Can't convert vaddr (%llx) of utsname to an offset.\n",
 		    utsname);
 		return FALSE;
 	}
@@ -5684,19 +5685,19 @@ show_data_xen()
 	 * Show data for debug
 	 */
 	MSG("\n");
-	MSG("SYMBOL(dom_xen): %lx\n", SYMBOL(dom_xen));
-	MSG("SYMBOL(dom_io): %lx\n", SYMBOL(dom_io));
-	MSG("SYMBOL(domain_list): %lx\n", SYMBOL(domain_list));
-	MSG("SYMBOL(xen_heap_start): %lx\n", SYMBOL(xen_heap_start));
-	MSG("SYMBOL(frame_table): %lx\n", SYMBOL(frame_table));
-	MSG("SYMBOL(alloc_bitmap): %lx\n", SYMBOL(alloc_bitmap));
-	MSG("SYMBOL(max_page): %lx\n", SYMBOL(max_page));
-	MSG("SYMBOL(pgd_l2): %lx\n", SYMBOL(pgd_l2));
-	MSG("SYMBOL(pgd_l3): %lx\n", SYMBOL(pgd_l3));
-	MSG("SYMBOL(pgd_l4): %lx\n", SYMBOL(pgd_l4));
-	MSG("SYMBOL(xenheap_phys_end): %lx\n", SYMBOL(xenheap_phys_end));
-	MSG("SYMBOL(xen_pstart): %lx\n", SYMBOL(xen_pstart));
-	MSG("SYMBOL(frametable_pg_dir): %lx\n", SYMBOL(frametable_pg_dir));
+	MSG("SYMBOL(dom_xen): %llx\n", SYMBOL(dom_xen));
+	MSG("SYMBOL(dom_io): %llx\n", SYMBOL(dom_io));
+	MSG("SYMBOL(domain_list): %llx\n", SYMBOL(domain_list));
+	MSG("SYMBOL(xen_heap_start): %llx\n", SYMBOL(xen_heap_start));
+	MSG("SYMBOL(frame_table): %llx\n", SYMBOL(frame_table));
+	MSG("SYMBOL(alloc_bitmap): %llx\n", SYMBOL(alloc_bitmap));
+	MSG("SYMBOL(max_page): %llx\n", SYMBOL(max_page));
+	MSG("SYMBOL(pgd_l2): %llx\n", SYMBOL(pgd_l2));
+	MSG("SYMBOL(pgd_l3): %llx\n", SYMBOL(pgd_l3));
+	MSG("SYMBOL(pgd_l4): %llx\n", SYMBOL(pgd_l4));
+	MSG("SYMBOL(xenheap_phys_end): %llx\n", SYMBOL(xenheap_phys_end));
+	MSG("SYMBOL(xen_pstart): %llx\n", SYMBOL(xen_pstart));
+	MSG("SYMBOL(frametable_pg_dir): %llx\n", SYMBOL(frametable_pg_dir));
 
 	MSG("SIZE(page_info): %ld\n", SIZE(page_info));
 	MSG("OFFSET(page_info.count_info): %ld\n", OFFSET(page_info.count_info));
makedumpfile.h +23 -30
@@ -258,7 +258,7 @@ do { \
 #define WRITE_SYMBOL(str_symbol, symbol) \
 do { \
 	if (SYMBOL(symbol) != NOT_FOUND_SYMBOL) { \
-		fprintf(info->file_vmcoreinfo, "%s%lx\n", \
+		fprintf(info->file_vmcoreinfo, "%s%llx\n", \
 		    STR_SYMBOL(str_symbol), SYMBOL(symbol)); \
 	} \
 } while (0)
@@ -802,39 +802,39 @@ struct vm_table {
 extern struct vm_table		vt;
 
 struct symbol_table {
-	unsigned long	mem_map;
-	unsigned long	mem_section;
-	unsigned long	pkmap_count;
-	unsigned long	pkmap_count_next;
-	unsigned long	system_utsname;
-	unsigned long	init_uts_ns;
-	unsigned long	_stext;
-	unsigned long	swapper_pg_dir;
-	unsigned long	init_level4_pgt;
-	unsigned long	phys_base;
-	unsigned long	node_online_map;
-	unsigned long	node_states;
-	unsigned long	node_memblk;
-	unsigned long	node_data;
-	unsigned long	pgdat_list;
-	unsigned long	contig_page_data;
+	unsigned long long	mem_map;
+	unsigned long long	mem_section;
+	unsigned long long	pkmap_count;
+	unsigned long long	pkmap_count_next;
+	unsigned long long	system_utsname;
+	unsigned long long	init_uts_ns;
+	unsigned long long 	_stext;
+	unsigned long long 	swapper_pg_dir;
+	unsigned long long 	init_level4_pgt;
+	unsigned long long 	phys_base;
+	unsigned long long 	node_online_map;
+	unsigned long long 	node_states;
+	unsigned long long 	node_memblk;
+	unsigned long long 	node_data;
+	unsigned long long 	pgdat_list;
+	unsigned long long 	contig_page_data;
 
 	/*
 	 * for Xen extraction
 	 */
-	unsigned long	dom_xen;
-	unsigned long	dom_io;
-	unsigned long	domain_list;
-	unsigned long	frame_table;
-	unsigned long	xen_heap_start;
-	unsigned long	pgd_l2;
-	unsigned long	pgd_l3;
-	unsigned long	pgd_l4;
-	unsigned long	xenheap_phys_end;
-	unsigned long	xen_pstart;
-	unsigned long	frametable_pg_dir;
-	unsigned long	max_page;
-	unsigned long	alloc_bitmap;
+	unsigned long long	dom_xen;
+	unsigned long long	dom_io;
+	unsigned long long	domain_list;
+	unsigned long long	frame_table;
+	unsigned long long	xen_heap_start;
+	unsigned long long	pgd_l2;

makedumpfile.h struct vm_table { · line 840

Quoted 10 lines
makedumpfile.h +7 -0
+	unsigned long long	pgd_l3;
+	unsigned long long	pgd_l4;
+	unsigned long long	xenheap_phys_end;
+	unsigned long long	xen_pstart;
+	unsigned long long	frametable_pg_dir;
+	unsigned long long	max_page;
+	unsigned long long	alloc_bitmap;
 };
 
 struct size_table {

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

#2 lore raw

Hi Ken'ichi,

Quoted 5 lines · Ken'ichi Ohmichi
Quoted 3 lines · Bernhard Walle

This bug fixes the generation of vmcoreinfo files on 32bit hosts for ELF64 files, i.e. 64bit kernels. The concrete problem was PPC64 which is built in a 32bit environment at SUSE.

Quoted 8 lines

I have one question.
I guess that the fundamental problem is that makedumpfile cannot use vmcoreinfo which is contained in /proc/vmcore on ppc64, right ? If yes, could you please test my attached patch for fixing it.

I created the kernel patch for adding the symbol "node_data" to ppc64's vmcoreinfo, but I cannot tested it because I don't have any ppc64 machine.

No, not directly. We still ship the makedumpfile.config. Yes, we plan to switch to /proc/vmcore vmcoreinfo for next release (SLES 11).

I'll test your patch on PPC and give feedback!

But I think the patch is also valid since makedumpfile.config file is still supported and should work.

Bernhard

Signature · 6 lines
Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development

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

Hi Bernhard,

Quoted 8 lines · Bernhard Walle
Quoted 8 lines
Quoted 3 lines

This bug fixes the generation of vmcoreinfo files on 32bit hosts for ELF64 files, i.e. 64bit kernels. The concrete problem was PPC64 which is built in a 32bit environment at SUSE.

I have one question.
I guess that the fundamental problem is that makedumpfile cannot use vmcoreinfo which is contained in /proc/vmcore on ppc64, right ? If yes, could you please test my attached patch for fixing it.

Quoted 8 lines
Quoted 3 lines

I created the kernel patch for adding the symbol "node_data" to ppc64's vmcoreinfo, but I cannot tested it because I don't have any ppc64 machine.

No, not directly. We still ship the makedumpfile.config. Yes, we plan to switch to /proc/vmcore vmcoreinfo for next release (SLES 11).

I'll test your patch on PPC and give feedback!

Sounds good to me :-)

Quoted 2 lines

But I think the patch is also valid since makedumpfile.config file is still supported and should work.

OK.
I think that your patch is good, and I will merge it to the next release anyway.

Thanks
Ken'ichi Ohmichi

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

#4 lore raw
Quoted 7 lines · Ken'ichi Ohmichi
Quoted 5 lines

No, not directly. We still ship the makedumpfile.config. Yes, we plan to switch to /proc/vmcore vmcoreinfo for next release (SLES 11).

I'll test your patch on PPC and give feedback!

Sounds good to me :-)

Sorry, cannot test because kdump is currently broken in our kernel on PPC64. Don't know why, we're investigating ...

Bernhard

Signature · 6 lines
Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development

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