rpms/kexec-tools/devel kexec-tools-1.101-x86-add_buffer_retry.patch, NONE, 1.1 kexec-tools.spec, 1.88, 1.89

Neil Horman (nhorman) fedora-extras-commits at redhat.com
Tue Jul 17 12:53:42 UTC 2007


Author: nhorman

Update of /cvs/extras/rpms/kexec-tools/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15199

Modified Files:
	kexec-tools.spec 
Added Files:
	kexec-tools-1.101-x86-add_buffer_retry.patch 
Log Message:
Resolves: bz 247989

kexec-tools-1.101-x86-add_buffer_retry.patch:

--- NEW FILE kexec-tools-1.101-x86-add_buffer_retry.patch ---
--- kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c.orig	2007-07-17 08:33:59.000000000 -0400
+++ kexec-tools-1.101/kexec/arch/i386/crashdump-x86.c	2007-07-17 08:34:13.000000000 -0400
@@ -663,6 +663,7 @@ int load_crashdump_segments(struct kexec
 	int nr_ranges, align = 1024;
 	long int nr_cpus = 0;
 	struct memory_range *mem_range, *memmap_p;
+	int i;
 
 	if (get_crash_memory_ranges(&mem_range, &nr_ranges) < 0)
 		return -1;
@@ -720,8 +721,13 @@ int load_crashdump_segments(struct kexec
 	 * elf core header segment to 16K to avoid being placed in such gaps.
 	 * This is a makeshift solution until it is fixed in kernel.
 	 */
-	elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base,
-							max_addr, -1);
+	for (i=0;i<KEXEC_MAX_SEGMENTS;i++) {
+		if ((memmap_p[i].start == 0) &&
+		    (memmap_p[i].end == 0))
+			break;
+	}
+	elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base, 
+				memmap_p[i-1].end, -1);
 	dfprintf(stdout, "Created elf header segment at 0x%lx\n", elfcorehdr);
 	if (delete_memmap(memmap_p, elfcorehdr, sz) < 0)
 		return -1;
--- kexec-tools-1.101/kexec/kexec.c.orig	2007-07-17 08:34:00.000000000 -0400
+++ kexec-tools-1.101/kexec/kexec.c	2007-07-17 08:34:13.000000000 -0400
@@ -327,6 +327,7 @@ unsigned long add_buffer(struct kexec_in
 	unsigned long base;
 	int result;
 	int pagesize;
+	int i;
 
 	result = sort_segments(info);
 	if (result < 0) {
@@ -336,11 +337,22 @@ unsigned long add_buffer(struct kexec_in
 	/* Round memsz up to a multiple of pagesize */
 	pagesize = getpagesize();
 	memsz = (memsz + (pagesize - 1)) & ~(pagesize - 1);
-
+retry:
 	base = locate_hole(info, memsz, buf_align, buf_min, buf_max, buf_end);
 	if (base == ULONG_MAX) {
 		die("locate_hole failed\n");
 	}
+
+	for (i = 0; i < info->nr_segments; i++) {
+		if ((base < (info->segment[i].mem + info->segment[i].memsz)) &&
+			((base+memsz) > info->segment[i].mem)) {
+			/*
+			 *we have an overlap, bump down buf_max
+			 */
+			buf_max = (unsigned long)info->segment[i].mem;
+			goto retry;
+		}
+	}
 	
 	add_segment(info, buf, bufsz, base, memsz);
 	return base;


Index: kexec-tools.spec
===================================================================
RCS file: /cvs/extras/rpms/kexec-tools/devel/kexec-tools.spec,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- kexec-tools.spec	9 Jul 2007 18:55:53 -0000	1.88
+++ kexec-tools.spec	17 Jul 2007 12:53:10 -0000	1.89
@@ -1,6 +1,6 @@
 Name: kexec-tools
 Version: 1.101
-Release: 73%{?dist}
+Release: 74%{?dist}
 License: GPL
 Group: Applications/System
 Summary: The kexec/kdump userspace component.
@@ -88,6 +88,7 @@
 Patch604: kexec-tools-1.101-elf-format.patch
 Patch605: kexec-tools-1.101-ifdown.patch
 Patch606: kexec-tools-1.101-reloc-update.patch
+Patch607: kexec-tools-1.101-x86-add_buffer_retry.patch
 
 %description
 kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -138,6 +139,7 @@
 %patch604 -p1
 %patch605 -p1
 %patch606 -p1
+%patch607 -p1
 
 tar -z -x -v -f %{SOURCE13}
 
@@ -250,6 +252,9 @@
 %doc kexec-kdump-howto.txt
 
 %changelog
+* Mon Jul 17 2007 Neil Horman <nhorman at redhat.com> - 1.101-74%{dist}
+- Fix up add_buff to retry locate_hole on segment overlap (bz 247989)
+
 * Mon Jul 09 2007 Neil Horman <nhorman at redhat.com> - 1.101-73%{dist}
 - Fix up language files for kexec (bz 246508)
 




More information about the scm-commits mailing list