Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9531d0f

Browse files
author
Dave Anderson
committedSep 25, 2015
For many years, Xen Dom0 dumps could only be saved in ELF format.
Since makedumpfile commit 349a0ed1, it is now possible to save Xen dumps in compressed kdump format. This patch set adds support for these files. Two new files, xen_dom0.c and xen_dom0.h, have been added to provide the common functionality required by both ELF and compressed kdump formats. (ptesarik@suse.cz)
1 parent c667f59 commit 9531d0f

9 files changed

+425
-363
lines changed
 

‎Makefile

+8-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ INSTALLDIR=${DESTDIR}/usr/bin
4747
# LDFLAGS will be configured automatically by configure
4848
LDFLAGS=
4949

50-
GENERIC_HFILES=defs.h xen_hyper_defs.h
50+
GENERIC_HFILES=defs.h xen_hyper_defs.h xen_dom0.h
5151
MCORE_HFILES=va_server.h vas_crash.h
5252
REDHAT_HFILES=netdump.h diskdump.h makedumpfile.h xendump.h kvmdump.h qemu-load.h
5353
LKCD_DUMP_HFILES=lkcd_vmdump_v1.h lkcd_vmdump_v2_v3.h lkcd_dump_v5.h \
@@ -70,7 +70,8 @@ CFILES=main.c tools.c global_data.c memory.c filesys.c help.c task.c \
7070
unwind_x86_32_64.c unwind_arm.c \
7171
xen_hyper.c xen_hyper_command.c xen_hyper_global_data.c \
7272
xen_hyper_dump_tables.c kvmdump.c qemu.c qemu-load.c sadump.c ipcs.c \
73-
ramdump.c vmware_vmss.c
73+
ramdump.c vmware_vmss.c \
74+
xen_dom0.c
7475

7576
SOURCE_FILES=${CFILES} ${GENERIC_HFILES} ${MCORE_HFILES} \
7677
${REDHAT_CFILES} ${REDHAT_HFILES} ${UNWIND_HFILES} \
@@ -88,7 +89,8 @@ OBJECT_FILES=main.o tools.o global_data.o memory.o filesys.o help.o task.o \
8889
unwind_x86_32_64.o unwind_arm.o \
8990
xen_hyper.o xen_hyper_command.o xen_hyper_global_data.o \
9091
xen_hyper_dump_tables.o kvmdump.o qemu.o qemu-load.o sadump.o ipcs.o \
91-
ramdump.o vmware_vmss.o
92+
ramdump.o vmware_vmss.o \
93+
xen_dom0.o
9294

9395
MEMORY_DRIVER_FILES=memory_driver/Makefile memory_driver/crash.c memory_driver/README
9496

@@ -497,6 +499,9 @@ xen_hyper_global_data.o: ${GENERIC_HFILES} xen_hyper_global_data.c
497499
xen_hyper_dump_tables.o: ${GENERIC_HFILES} xen_hyper_dump_tables.c
498500
${CC} -c ${CRASH_CFLAGS} xen_hyper_dump_tables.c ${WARNING_OPTIONS} ${WARNING_ERROR}
499501

502+
xen_dom0.o: ${GENERIC_HFILES} xen_dom0.c
503+
${CC} -c ${CRASH_CFLAGS} xen_dom0.c ${WARNING_OPTIONS} ${WARNING_ERROR}
504+
500505
ramdump.o: ${GENERIC_HFILES} ${REDHAT_HFILES} ramdump.c
501506
${CC} -c ${CRASH_CFLAGS} ramdump.c ${WARNING_OPTIONS} ${WARNING_ERROR}
502507

‎diskdump.c

+27
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "defs.h"
2727
#include "diskdump.h"
28+
#include "xen_dom0.h"
2829

2930
#define BITMAP_SECT_LEN 4096
3031

@@ -285,6 +286,13 @@ process_elf32_notes(void *note_buf, unsigned long size_note)
285286
dd->nt_qemu_percpu[qemu_num] = nt;
286287
qemu_num++;
287288
}
289+
if (nt->n_type == NT_XEN_KDUMP_CR3 ||
290+
nt->n_type == XEN_ELFNOTE_CRASH_INFO) {
291+
void *data = (char*)(nt + 1) +
292+
roundup(nt->n_namesz, 4);
293+
process_xen_note(nt->n_type, data, nt->n_descsz);
294+
}
295+
288296
len = roundup(len + nt->n_namesz, 4);
289297
len = roundup(len + nt->n_descsz, 4);
290298
}
@@ -327,6 +335,12 @@ process_elf64_notes(void *note_buf, unsigned long size_note)
327335
dd->nt_qemu_percpu[qemu_num] = nt;
328336
qemu_num++;
329337
}
338+
if (nt->n_type == NT_XEN_KDUMP_CR3 ||
339+
nt->n_type == XEN_ELFNOTE_CRASH_INFO) {
340+
void *data = (char*)(nt + 1) +
341+
roundup(nt->n_namesz, 4);
342+
process_xen_note(nt->n_type, data, nt->n_descsz);
343+
}
330344

331345
len = roundup(len + nt->n_namesz, 4);
332346
len = roundup(len + nt->n_descsz, 4);
@@ -1165,6 +1179,19 @@ read_diskdump(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
11651179
int ret;
11661180
physaddr_t curpaddr;
11671181
ulong pfn, page_offset;
1182+
physaddr_t paddr_in = paddr;
1183+
1184+
if (XEN_CORE_DUMPFILE() && !XEN_HYPER_MODE()) {
1185+
if ((paddr = xen_kdump_p2m(paddr)) == P2M_FAILURE) {
1186+
if (CRASHDEBUG(8))
1187+
fprintf(fp, "read_diskdump: xen_kdump_p2m(%llx): "
1188+
"P2M_FAILURE\n", (ulonglong)paddr_in);
1189+
return READ_ERROR;
1190+
}
1191+
if (CRASHDEBUG(8))
1192+
fprintf(fp, "read_diskdump: xen_kdump_p2m(%llx): %llx\n",
1193+
(ulonglong)paddr_in, (ulonglong)paddr);
1194+
}
11681195

11691196
pfn = paddr_to_pfn(paddr);
11701197

‎ia64.c

+11-12
Original file line numberDiff line numberDiff line change
@@ -3848,6 +3848,7 @@ ia64_vtop_xen_wpt(ulong vaddr, physaddr_t *paddr, ulong *pgd, int verbose, int u
38483848
}
38493849

38503850
#include "netdump.h"
3851+
#include "xen_dom0.h"
38513852

38523853
/*
38533854
* Determine the relocatable physical address base.
@@ -3982,13 +3983,12 @@ static int
39823983
ia64_xen_kdump_p2m_create(struct xen_kdump_data *xkd)
39833984
{
39843985
/*
3985-
* Temporarily read physical (machine) addresses from vmcore by
3986-
* going directly to read_netdump() instead of via read_kdump().
3986+
* Temporarily read physical (machine) addresses from vmcore.
39873987
*/
3988-
pc->readmem = read_netdump;
3988+
pc->curcmd_flags |= XEN_MACHINE_ADDR;
39893989

39903990
if (CRASHDEBUG(1)) {
3991-
fprintf(fp, "readmem (temporary): read_netdump()\n");
3991+
fprintf(fp, "readmem (temporary): force XEN_MACHINE_ADDR\n");
39923992
fprintf(fp, "ia64_xen_kdump_p2m_create: p2m_mfn: %lx\n", xkd->p2m_mfn);
39933993
}
39943994

@@ -4001,9 +4001,9 @@ ia64_xen_kdump_p2m_create(struct xen_kdump_data *xkd)
40014001

40024002
xkd->p2m_frames = PAGESIZE()/sizeof(ulong);
40034003

4004-
pc->readmem = read_kdump;
4004+
pc->curcmd_flags &= ~XEN_MACHINE_ADDR;
40054005
if (CRASHDEBUG(1))
4006-
fprintf(fp, "readmem (restore): read_kdump()\n");
4006+
fprintf(fp, "readmem (restore): p2m translation\n");
40074007

40084008
return TRUE;
40094009
}
@@ -4016,12 +4016,11 @@ ia64_xen_kdump_p2m(struct xen_kdump_data *xkd, physaddr_t pseudo)
40164016
physaddr_t paddr;
40174017

40184018
/*
4019-
* Temporarily read physical (machine) addresses from vmcore by
4020-
* going directly to read_netdump() instead of via read_kdump().
4019+
* Temporarily read physical (machine) addresses from vmcore.
40214020
*/
4022-
pc->readmem = read_netdump;
4021+
pc->curcmd_flags |= XEN_MACHINE_ADDR;
40234022
if (CRASHDEBUG(1))
4024-
fprintf(fp, "readmem (temporary): read_netdump()\n");
4023+
fprintf(fp, "readmem (temporary): force XEN_MACHINE_ADDR\n");
40254024

40264025
xkd->accesses += 2;
40274026

@@ -4073,9 +4072,9 @@ ia64_xen_kdump_p2m(struct xen_kdump_data *xkd, physaddr_t pseudo)
40734072
paddr = (paddr & _PFN_MASK) | PAGEOFFSET(pseudo);
40744073

40754074
out:
4076-
pc->readmem = read_kdump;
4075+
pc->curcmd_flags &= ~XEN_MACHINE_ADDR;
40774076
if (CRASHDEBUG(1))
4078-
fprintf(fp, "readmem (restore): read_kdump()\n");
4077+
fprintf(fp, "readmem (restore): p2m translation\n");
40794078

40804079
return paddr;
40814080
}

0 commit comments

Comments
 (0)
Please sign in to comment.