diff options
author | Daniel Kiper <daniel.kiper@oracle.com> | 2012-07-05 14:16:35 +0200 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2012-07-06 22:45:22 +0900 |
commit | 455d79f57e9367e5c59093fd74798905bd5762fc (patch) | |
tree | 5cd5f972d8154142d7cbb17b2651baef6265a45a | |
parent | be902019c6161ecead58d2789c73e2999ed9c30b (diff) |
kexec-tools: Read always one vmcoreinfo file
vmcoreinfo file could exists under /sys/kernel (valid on baremetal only)
and/or under /sys/hypervisor (valid when Xen dom0 is running).
Read only one of them. It means that only one PT_NOTE will be
always created. Remove extra code for second PT_NOTE creation.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/crashdump-elf.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c index 8d82db9..ec66548 100644 --- a/kexec/crashdump-elf.c +++ b/kexec/crashdump-elf.c @@ -40,8 +40,6 @@ int FUNC(struct kexec_info *info, 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()) @@ -53,16 +51,14 @@ int FUNC(struct kexec_info *info, return -1; } - if (get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len) == 0) { - has_vmcoreinfo = 1; - } - - if (xen_present() && - get_xen_vmcoreinfo(&vmcoreinfo_addr_xen, &vmcoreinfo_len_xen) == 0) { - has_vmcoreinfo_xen = 1; - } + if (xen_present()) { + if (!get_xen_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len)) + has_vmcoreinfo = 1; + } else + if (!get_kernel_vmcoreinfo(&vmcoreinfo_addr, &vmcoreinfo_len)) + has_vmcoreinfo = 1; - sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo + has_vmcoreinfo_xen) * sizeof(PHDR) + + sz = sizeof(EHDR) + (nr_cpus + has_vmcoreinfo) * sizeof(PHDR) + ranges * sizeof(PHDR); /* @@ -179,21 +175,6 @@ int FUNC(struct kexec_info *info, 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 elf_info->kern_size is non-zero. */ |