extract vmcoreinfo from /proc/vmcore for Xen
Subsystems (2)
PATCH 3/4 extract vmcoreinfo from /proc/vmcore for Xen
This patch is for kexec-tools-testing-20080324.
crashdump.c renamed from crashdump.c.org +13 -5
@@ -110,10 +110,8 @@return 0 ; } -/* Returns the physical address of start of crash notes buffer for a kernel. */ -int get_kernel_vmcoreinfo (uint64_t *addr,uint64_t *len) +static int get_vmcoreinfo (char *kdump_info,uint64_t *addr,uint64_t *len) { -char kdump_info[PATH_MAX ];char line[MAX_LINE ];int count;FILE *fp;
@@ -122,9 +120,8 @@ *addr =0 ; *len =0 ; -sprintf (kdump_info,"/sys/kernel/vmcoreinfo" );if (!(fp =fopen (kdump_info,"r" ))) -return 0 ; +return -1 ;if (!fgets (line,sizeof (line), fp))die ("Cannot parse %s: %s\n" , kdump_info,strerror (errno));
@@ -137,3 +134,14 @@return 0 ; } + +/* Returns the physical address of start of crash notes buffer for a kernel. */ +int get_kernel_vmcoreinfo (uint64_t *addr,uint64_t *len) +{ +return get_vmcoreinfo ("/sys/kernel/vmcoreinfo" , addr, len); +} + +int get_xen_vmcoreinfo (uint64_t *addr,uint64_t *len) +{ +return get_vmcoreinfo ("/sys/hypervisor/vmcoreinfo" , addr, len); +}
crashdump.h renamed from crashdump.h.org +1 -0
@@ -3,6 +3,7 @@extern int get_crash_notes_per_cpu (int cpu,uint64_t *addr,uint64_t *len);extern int get_kernel_vmcoreinfo (uint64_t *addr,uint64_t *len); +extern int get_xen_vmcoreinfo (uint64_t *addr,uint64_t *len);/* Need to find a better way to determine per cpu notes section size. */ #define MAX_NOTE_BYTES 1024
crashdump-elf.c renamed from crashdump-elf.c.org +23 -1
@@ -36,6 +36,8 @@uint64_t notes_addr, notes_len;uint64_t vmcoreinfo_addr, vmcoreinfo_len;int has_vmcoreinfo =0 ; +uint64_t vmcoreinfo_addr_xen, vmcoreinfo_len_xen; +int has_vmcoreinfo_xen =0 ;int (*get_note_info)(int cpu,uint64_t *addr,uint64_t *len);if (xen_present ())
@@ -51,7 +53,12 @@ has_vmcoreinfo =1 ; } - sz =sizeof (EHDR ) + (nr_cpus + has_vmcoreinfo) *sizeof (PHDR ) + +if (xen_present () && +get_xen_vmcoreinfo (&vmcoreinfo_addr_xen, &vmcoreinfo_len_xen) ==0 ) { + has_vmcoreinfo_xen =1 ; + } + + sz =sizeof (EHDR ) + (nr_cpus + has_vmcoreinfo + has_vmcoreinfo_xen) *sizeof (PHDR ) + ranges *sizeof (PHDR );/*
@@ -168,6 +175,21 @@dbgprintf_phdr ("vmcoreinfo header" , phdr); } +if (has_vmcoreinfo_xen) { + phdr = (PHDR *) bufp; + bufp +=sizeof (PHDR ); + phdr->p_type =PT_NOTE ; + phdr->p_flags =0 ; + phdr->p_offset = phdr->p_paddr = vmcoreinfo_addr_xen; + phdr->p_vaddr =0 ; + phdr->p_filesz = phdr->p_memsz = vmcoreinfo_len_xen; +/* Do we need any alignment of segments? */ + phdr->p_align =0 ; + + (elf->e_phnum)++; +dbgprintf_phdr ("vmcoreinfo_xen header" , phdr); + } +/* Setup an PT_LOAD type program header for the region where * Kernel is mapped if info->kern_size is non-zero. */
Signature · 1 line
Itsuro ODA <[email protected]>
Quoted 1 line · Itsuro ODA
This patch is for kexec-tools-testing-20080324.
This looks fine to me. Are you expecting any compatibility issues to crop up? If not, I'm happy to go ahead an merge this code.
full disclosure: Oda-san and I both work at VA Linux Japan, so if someone else wants to review the code please feel free.
Signature · 1 line
Horms
Hi,
Quoted 5 lines · On Mon, 31 Mar 2008 14:31:01 +0900 Simon Horman <[email protected]> wrote:
Quoted 1 line · Itsuro ODA
This patch is for kexec-tools-testing-20080324.
This looks fine to me. Are you expecting any compatibility issues to crop up? If not, I'm happy to go ahead an merge this code.
no compatibility issue.
Quoted 6 lines
full disclosure: Oda-san and I both work at VA Linux Japan, so if someone else wants to review the code please feel free.
Signature · 1 line
Horms
Thanks.
Signature · 1 line
Itsuro ODA <[email protected]>
Quoted 8 lines · Simon Horman
Quoted 1 line · Itsuro ODA
This patch is for kexec-tools-testing-20080324.
This looks fine to me. Are you expecting any compatibility issues to crop up? If not, I'm happy to go ahead an merge this code.
full disclosure: Oda-san and I both work at VA Linux Japan, so if someone else wants to review the code please feel free.
As there wasn't any further discussion I have gone ahead and applied this patch.