Xen-specific ELF notes are interpreted in kdump compressed files and
physical addresses are translated to machine addresses if needed.

Without this patch, crash fails during initialization with a message
like this:

WARNING: could not find MAGIC_START!
WARNING: cannot read linux_banner string
crash: vmlinux-3.0.34-0.7-xen.debug and vmcore-xen.d31 do not match!

Signed-off-by: Petr Tesarik <[email protected]>
---
 diskdump.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/diskdump.c b/diskdump.c
index 72df26f..2dbe472 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -25,6 +25,7 @@
 
 #include "defs.h"
 #include "diskdump.h"
+#include "xen_dom0.h"
 
 #define BITMAP_SECT_LEN        4096
 
@@ -285,6 +286,13 @@ process_elf32_notes(void *note_buf, unsigned long 
size_note)
                        dd->nt_qemu_percpu[qemu_num] = nt;
                        qemu_num++;
                }
+               if (nt->n_type == NT_XEN_KDUMP_CR3 ||
+                   nt->n_type == XEN_ELFNOTE_CRASH_INFO) {
+                       void *data = (char*)(nt + 1) +
+                               roundup(nt->n_namesz, 4);
+                       process_xen_note(nt->n_type, data, nt->n_descsz);
+               }
+
                len = roundup(len + nt->n_namesz, 4);
                len = roundup(len + nt->n_descsz, 4);
        }
@@ -327,6 +335,12 @@ process_elf64_notes(void *note_buf, unsigned long 
size_note)
                        dd->nt_qemu_percpu[qemu_num] = nt;
                        qemu_num++;
                }
+               if (nt->n_type == NT_XEN_KDUMP_CR3 ||
+                   nt->n_type == XEN_ELFNOTE_CRASH_INFO) {
+                       void *data = (char*)(nt + 1) +
+                               roundup(nt->n_namesz, 4);
+                       process_xen_note(nt->n_type, data, nt->n_descsz);
+               }
 
                len = roundup(len + nt->n_namesz, 4);
                len = roundup(len + nt->n_descsz, 4);
@@ -1165,6 +1179,19 @@ read_diskdump(int fd, void *bufptr, int cnt, ulong addr, 
physaddr_t paddr)
        int ret;
        physaddr_t curpaddr;
        ulong pfn, page_offset;
+       physaddr_t paddr_in = paddr;
+
+       if (XEN_CORE_DUMPFILE() && !XEN_HYPER_MODE()) {
+               if ((paddr = xen_kdump_p2m(paddr)) == P2M_FAILURE) {
+                       if (CRASHDEBUG(8))
+                               fprintf(fp, "read_diskdump: 
xen_kdump_p2m(%llx): "
+                                       "P2M_FAILURE\n", (ulonglong)paddr_in);
+                       return READ_ERROR;
+               }
+               if (CRASHDEBUG(8))
+                       fprintf(fp, "read_diskdump: xen_kdump_p2m(%llx): 
%llx\n",
+                               (ulonglong)paddr_in, (ulonglong)paddr);
+       }
 
        pfn = paddr_to_pfn(paddr);
 
-- 
2.1.4

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to