Mohan Kumar M wrote:

Hello,

I am attaching 4 kexec-tools patches to check whether the current kernel
has reserved memory for crashkernel or not. The check is done by calling
architecture dependent functions. If no memory is reserved for
crashkernel, it displays an appropriate error message and exits.

PATCH 1: Checks for crashkernel memory reservation by calling arch
dependent function. It also creates dummy function for ppc, ia64 and
s390 architectures to avoid problem in build process.

PATCH 2: ppc64 specific crashkernel memory reservation check

PATCH 3: i386 specific crashkernel memory reservation check

PATCH 4: x86-64 specific crashkernel memory reservation check

I update the patches by placing "is_crashkernel_mem_reserved"
functions in appropriate files as suggested by Vivek.

Any suggestion, feedback?
Mohan, sorry for the late feedback.

Actually, I was talking about reporting error message in arch specific code itself. Attaching the patch (not tested).

Thanks
Haren

diff -Naurp kexec-tools.orig/kexec/arch/i386/crashdump-x86.c kexec-tools/kexec/arch/i386/crashdump-x86.c
--- kexec-tools.orig/kexec/arch/i386/crashdump-x86.c	2006-10-10 10:07:47.000000000 -0700
+++ kexec-tools/kexec/arch/i386/crashdump-x86.c	2006-10-10 10:09:13.000000000 -0700
@@ -106,6 +106,8 @@ static int get_crash_memory_ranges(struc
 		} else {
 			continue;
 		}
+		if (!crash_reserved_mem.start)
+                        die("Memory for kdump kernel is not reserved\n");
 
 		/* First 640K already registered */
 		if (start >= 0x00000000 && end <= 0x0009ffff)
diff -Naurp kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c kexec-tools/kexec/arch/ppc64/kexec-ppc64.c
--- kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c	2006-10-10 10:07:28.000000000 -0700
+++ kexec-tools/kexec/arch/ppc64/kexec-ppc64.c	2006-10-10 10:10:12.000000000 -0700
@@ -225,9 +225,11 @@ static int get_devtree_details(unsigned 
 				strcat(fname, dentry->d_name);
 				strcat(fname, "/linux,crashkernel-base");
 				if ((file = fopen(fname, "r")) == NULL) {
-					perror(fname);
 					closedir(cdir);
 					closedir(dir);
+					if (errno == ENOENT) 
+						die("Memory for kdump kernel is not reserved\n");
+					perror(fname);
 					return -1;
 				}
 				if (fread(&crash_base, sizeof(unsigned long), 1,
diff -Naurp kexec-tools.orig/kexec/arch/x86_64/crashdump-x86_64.c kexec-tools/kexec/arch/x86_64/crashdump-x86_64.c
--- kexec-tools.orig/kexec/arch/x86_64/crashdump-x86_64.c	2006-10-10 10:08:21.000000000 -0700
+++ kexec-tools/kexec/arch/x86_64/crashdump-x86_64.c	2006-10-10 10:08:39.000000000 -0700
@@ -117,6 +117,9 @@ static int get_crash_memory_ranges(struc
 			continue;
 		}
 
+		if (!crash_reserved_mem.start)
+                        die("Memory for kdump kernel is not reserved\n");
+
 		/* First 640K already registered */
 		if (start >= 0x00000000 && end <= 0x0009ffff)
 			continue;
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to