Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [makedumpfile] Add `holes' in bitmap
@ 2007-05-18 10:50 Bernhard Walle
  0 siblings, 0 replies; only message in thread
From: Bernhard Walle @ 2007-05-18 10:50 UTC (permalink / raw)
  To: Ken'ichi Ohmichi; +Cc: kexec

On a big SGI machine with more than one node I experienced the problem that the
remaining buffer was larger than PFN_BUFBITMAP which resulted in an error.

I think the cause is that the holes must be filled in the bitmap. This patch
implements this.


Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
 makedumpfile.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3142,11 +3142,34 @@ create_dump_bitmap(struct DumpInfo *info
 	}
 
 	for (mm = 0; mm < info->num_mem_map; mm++) {
+		unsigned long long next_pfn_start;
+
 		mmd = &info->mem_map_data[mm];
 		pfn   = mmd->pfn_start;
 		paddr = pfn*info->page_size;
 		mem_map = mmd->mem_map;
 
+		/*
+		 * fill with zeros if start != 0
+		 */
+		if (mm == 0 && pfn != 0) {
+			int i;
+
+			for (;i < pfn; i++) {
+				set_bitmap(bm1.buf, i % BUFSIZE_BITMAP, 0);
+				set_bitmap(bm2.buf, i % BUFSIZE_BITMAP, 0);
+
+				if ((i % PFN_BUFBITMAP) == 0) {
+					bm1.buf_size = BUFSIZE_BITMAP;
+					bm2.buf_size = BUFSIZE_BITMAP;
+					if (!write_cache_bufsz(&bm1))
+						goto out;
+					if (!write_cache_bufsz(&bm2))
+						goto out;
+				}
+			}
+		}
+
 		if (mem_map == NOT_MEMMAP_ADDR)
 			not_found_mem_map = TRUE;
 		else
@@ -3291,6 +3314,34 @@ create_dump_bitmap(struct DumpInfo *info
 			 */
 			set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, val);
 		}
+
+		/*
+		 * fill the space between the memory maps with zeros
+		 */
+
+		if (mm != (info->num_mem_map - 1))
+			next_pfn_start = info->mem_map_data[mm+1].pfn_start;
+		else
+			next_pfn_start = info->max_mapnr;
+
+		for (; pfn < next_pfn_start; pfn++) {
+
+			/*
+			 * flush to disk
+			 */
+			if ((pfn % PFN_BUFBITMAP) == 0) {
+
+				bm1.buf_size = BUFSIZE_BITMAP;
+				bm2.buf_size = BUFSIZE_BITMAP;
+				if (!write_cache_bufsz(&bm1))
+					goto out;
+				if (!write_cache_bufsz(&bm2))
+					goto out;
+			}
+
+			set_bitmap(bm1.buf, pfn%PFN_BUFBITMAP, 0);
+			set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 0);
+		}
 	}
 
 	/*

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-18 10:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-18 10:50 [PATCH] [makedumpfile] Add `holes' in bitmap Bernhard Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox