File makedumpfile-xen-compressed-dump.patch of Package makedumpfile

From: Petr Tesarik <ptesarik@suse.com>
Subject: Enable compressed dump formats for Xen
References: FATE#316467
Patch-mainline: v1.5.9

Originally, the compressed KDUMP format was not sufficient for Xen
Dom0 dumps, because it did not contain required Xen-specific
information. However, all this info is stored in ELF notes, which
have been present in the compressed file since version 4, so there
is no longer any reason to restrict Xen dumps to ELF only.

One minor fix is necessary. In a Xen dump, PFN refers to physical
pages _inside_ Dom0, but when compressing the whole file, the machine
pages are used in fact (although the variable is still called pfn).
Consequently, readmem() must interpret the address as a machine
address rather than Dom0 physical address when saving Xen files.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>

---
 makedumpfile.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5933,9 +5933,11 @@ int
 read_pfn(unsigned long long pfn, unsigned char *buf)
 {
 	unsigned long long paddr;
+	int type_addr;
 
 	paddr = pfn_to_paddr(pfn);
-	if (!readmem(PADDR, paddr, buf, info->page_size)) {
+	type_addr = is_xen_memory() ? MADDR_XEN : PADDR;
+	if (!readmem(type_addr, paddr, buf, info->page_size)) {
 		ERRMSG("Can't get the page data.\n");
 		return FALSE;
 	}
@@ -7770,12 +7772,6 @@ initial_xen(void)
 	MSG("Xen is not supported on powerpc.\n");
 	return FALSE;
 #else
-	if(!info->flag_elf_dumpfile && !info->flag_dmesg) {
-		MSG("Specify '-E' option for Xen.\n");
-		MSG("Commandline parameter is invalid.\n");
-		MSG("Try `makedumpfile --help' for more information.\n");
-		return FALSE;
-	}
 #ifndef __x86_64__
 	if (DL_EXCLUDE_ZERO < info->max_dump_level) {
 		MSG("Dump_level is invalid. It should be 0 or 1.\n");
openSUSE Build Service is sponsored by