Hi, > 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 On Tue, 31 Jul 2007 07:19:48 +0900 Itsuro ODA <oda at valinux.co.jp> wrote: > Hi, > > > 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. > -- > Itsuro ODA <oda at valinux.co.jp> > > > _______________________________________________ > kexec mailing list > kexec at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexe -- --- 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 <oda at valinux.co.jp>