Skip to contentSkip to conversation

makedumpfile-1.1.5: Xen support

DISCUSSION Itsuro ODA 1 participant 1 message Aug 13, 2007

Subsystems (2)
lore
Share & tools
lore

Itsuro ODA

author
#0 lore raw

Hi,

Quoted 2 lines

Hmm, adding to skip zero-filled pages is easy but I wonder how effective it is ...

I found it is sometimes effective.

The attached patch enables the "-d" option with --xen-syms. Note that only the level 1 (skip zero-filled pages) is supported.

ex. # makedumpfile -E -d 1 --xen-syms xen-syms.debug vmcore output

Thanks.
Itsuro Oda

Quoted 20 lines · On Tue, 31 Jul 2007 07:19:48 +0900 Itsuro ODA <[email protected]> wrote:

Hi,

Quoted 3 lines

Is the "-d" dump_level option completely ignored, or can it (without vmlinux awareness) recognize and skip zero-filled pages?

Yes, "-d" is ignored.

Hmm, adding to skip zero-filled pages is easy but I wonder how effective it is ...

Thanks.

Signature · 7 lines
Itsuro ODA <[email protected]>


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexe
Signature · 91 lines
--- makedumpfile.c.org	2007-08-10 15:14:22.000000000 +0900
+++ makedumpfile.c	2007-08-10 15:51:16.000000000 +0900
@@ -5195,6 +5195,9 @@
 	int i;
 	struct pt_load_segment *pls;
 	int ret = FALSE;
+	unsigned long long paddr;
+	off_t offset_page;
+	unsigned char *buf = NULL;
 
 	/*
 	 * NOTE: the first half of bitmap is not used for Xen extraction
@@ -5211,6 +5214,11 @@
 		    strerror(errno));
 		goto out;
 	}
+	if ((buf = malloc(info->page_size)) == NULL) {
+		ERRMSG("Can't allocate memory for the page. %s\n",
+		    strerror(errno));
+		goto out;
+	}
 
 	pfn = 0;
 	for (i = 0; i < info->num_load_memory; i++) {
@@ -5255,11 +5263,35 @@
 			 *  - xen heap area, or
 			 *  - selected domain page
 			 */
-			if (_domain == 0 ||
+			if (!(_domain == 0 ||
 				(info->xen_heap_start <= pfn && pfn < info->xen_heap_end) ||
-				((count_info & 0xffff) && is_select_domain(info, _domain))) {
-				set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 1);
+				((count_info & 0xffff) && is_select_domain(info, _domain)))) {
+				continue;
+			}
+			if (info->dump_level & DL_EXCLUDE_ZERO) {
+				paddr = (unsigned long long)pfn * info->page_size;
+				offset_page = paddr_to_offset(info, paddr);
+				if (!offset_page) {
+					ERRMSG("Can't convert physaddr(%llx) to a offset.\n",
+					    paddr);
+					goto out;
+				}
+				if (lseek(info->fd_memory, offset_page,
+				    SEEK_SET) == (off_t)-1) {
+					ERRMSG("Can't seek the dump memory(%s). %s\n",
+					    info->name_memory, strerror(errno));
+					goto out;
+				}
+				if (read(info->fd_memory, buf, info->page_size)
+				    != info->page_size) {
+					ERRMSG("Can't read the dump memory(%s). %s\n",
+					    info->name_memory, strerror(errno));
+					goto out;
+				}
+				if (is_zero_page(buf, info->page_size))
+					continue;
 			}
+			set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 1);
 		}
 	}
 
@@ -5275,6 +5307,8 @@
 out:
 	if (bm2.buf != NULL)
 		free(bm2.buf);
+	if (buf != NULL)
+		free(buf);
 
 	return ret;
 }
@@ -5546,7 +5580,7 @@
 			MSG("-E must be specified with --xen-syms or --xen-vmcoreinfo.\n");
 			goto out;
 		}
-		info->dump_level = DL_EXCLUDE_XEN;
+		info->dump_level |= DL_EXCLUDE_XEN;
 		return handle_xen(info);
 
 	} else if (info->flag_rearrange) {


-- 
Itsuro ODA <[email protected]>


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec