[Fastboot] Zero size /proc/vmcore on ia64

Horms horms at verge.net.au
Tue Feb 13 01:19:58 PST 2007


On Tue, Feb 13, 2007 at 09:08:06AM +0800, Zou, Nanhai wrote:
> > -----Original Message-----
> > From: linux-ia64-owner at vger.kernel.org
> > [mailto:linux-ia64-owner at vger.kernel.org] On Behalf Of Bernhard Walle
> > Sent: 2007年2月13日 5:50
> > To: fastboot at lists.osdl.org; Linux-IA64
> > Subject: Re: [Fastboot] Zero size /proc/vmcore on ia64
> > 
> > * Bernhard Walle <bwalle at suse.de> [2007-02-12 19:57]:
> > > * Zou, Nanhai <nanhai.zou at intel.com> [2007-02-09 00:45]:
> > > >  I have not implement serial print in purgatory code yet, see
> > > >  comments in purgatory/arch/ia64/console-ia64.c However from your
> > > >  print, I can see last 2 entries of efi mem map are corrupt.
> > >
> > > I have the same problem (corrupted memory map entries), and the cause
> > > was in kexec-tools, patch below. I'm not sure if the fix is right, at
> > > least the problem is the uninitialised value of size. :)
> > 
> > But that patch doesn't fix the zero-size problem, it just fixes the
> > invalid EFI map problem. That patch (against kexec-tools, not against
> > the kernel) fixes both.
> > 
> > The problem is simply that the space for the core header doesn't
> > occupy a EFI page.

Thanks a lot for working that out. It does indeed seem to solve the
problem, though I wonder adding an alignment parameter to
crash_create_XXX_headers(), as per the patch below, is a better
way to achive this.

[snip]

>   The kexec-tools version seems to be different.

I believe that Bernhard is using the kexec-tools-testing tree.
It would be totally awsome if you could check that code
out some time and see if it works for you.

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


Subject: kexec-tools: Add alignment parameter to crash_create_XXX_headers
From: Simon Horman <horms at verge.net.au>
To: fastboot at lists.osdl.org, Linux-IA64 <linux-ia64 at vger.kernel.org>
Cc: Cc: Bernhard Walle <bwalle at suse.de>,
	Magnus Damm <magnus.damm at gmail.com>,
	Zou, Nanhai <nanhai.zou at intel.com>

crash_create_XXX_headers assumes that all arhitectures need an alignment of
1024bytes. But on ia64 at least this is not true. This patch adds an
alignment parameter to crash_create_XXX_headers, and calls passes
a value of 1024 for all architectures except ia64, where EFI_PAGE_SIZE (4096)
is passed.

If there are problems with alignment on other architectures hopefully
this facility will work for them too.

Cc: Bernhard Walle <bwalle at suse.de>
Cc: Magnus Damm <magnus.damm at gmail.com>
Cc: Zou, Nanhai <nanhai.zou at intel.com>
Signed-off-by: Simon Horman <horms at verge.net.au>


 kexec/arch/i386/crashdump-x86.c      |    4 ++--
 kexec/arch/ia64/crashdump-ia64.c     |    5 +++--
 kexec/arch/ppc64/crashdump-ppc64.c   |    4 ++--
 kexec/arch/x86_64/crashdump-x86_64.c |    2 +-
 kexec/crashdump-elf.c                |   11 ++---------
 kexec/crashdump.h                    |    6 ++++--
 6 files changed, 14 insertions(+), 18 deletions(-)

Index: kexec-tools-bw/kexec/arch/i386/crashdump-x86.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/i386/crashdump-x86.c	2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/i386/crashdump-x86.c	2007-02-13 17:39:26.000000000 +0900
@@ -524,13 +524,13 @@
 	if (arch_options.core_header_type == CORE_TYPE_ELF64) {
 		if (crash_create_elf64_headers(info, &elf_info64,
 					       crash_memory_range, nr_ranges,
-					       &tmp, &sz) < 0)
+					       &tmp, &sz, 1024) < 0)
 			return -1;
 	}
 	else {
 		if (crash_create_elf32_headers(info, &elf_info32,
 					       crash_memory_range, nr_ranges,
-					       &tmp, &sz) < 0)
+					       &tmp, &sz, 1024) < 0)
 			return -1;
 	}
 
Index: kexec-tools-bw/kexec/arch/ia64/crashdump-ia64.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/ia64/crashdump-ia64.c	2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/ia64/crashdump-ia64.c	2007-02-13 18:09:44.000000000 +0900
@@ -232,13 +232,14 @@
 			if (crash_create_elf64_headers(info, &elf_info,
 						       crash_memory_range,
 						       nr_ranges,
-						       &tmp, &sz) < 0)
+						       &tmp, &sz,
+						       4096) < 0)
 				return -1;
 
 			elfcorehdr = add_buffer(info, tmp, sz, sz, EFI_PAGE_SIZE, min_base,
 					max_addr, -1);
 			loaded_segments[loaded_segments_num].start = elfcorehdr;
-			loaded_segments[loaded_segments_num].end = elfcorehdr + size;
+			loaded_segments[loaded_segments_num].end = elfcorehdr + sz;
 			loaded_segments[loaded_segments_num].reserved = 1;
 			loaded_segments_num++;
 			cmdline_add_elfcorehdr(cmdline, elfcorehdr);
Index: kexec-tools-bw/kexec/arch/ppc64/crashdump-ppc64.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/ppc64/crashdump-ppc64.c	2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/ppc64/crashdump-ppc64.c	2007-02-13 17:39:26.000000000 +0900
@@ -344,13 +344,13 @@
 	if (arch_options.core_header_type == CORE_TYPE_ELF64) {
 		if (crash_create_elf64_headers(info, &elf_info64,
 					       crash_memory_range, nr_ranges,
-					       &tmp, &sz) < 0)
+					       &tmp, &sz, 1024) < 0)
 			return -1;
 	}
 	else {
 		if (crash_create_elf32_headers(info, &elf_info32,
 					       crash_memory_range, nr_ranges,
-					       &tmp, &sz) < 0)
+					       &tmp, &sz, 1024) < 0)
 			return -1;
 	}
 
Index: kexec-tools-bw/kexec/arch/x86_64/crashdump-x86_64.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/x86_64/crashdump-x86_64.c	2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/x86_64/crashdump-x86_64.c	2007-02-13 17:39:26.000000000 +0900
@@ -607,7 +607,7 @@
 	/* Create elf header segment and store crash image data. */
 	if (crash_create_elf64_headers(info, &elf_info,
 				       crash_memory_range, nr_ranges,
-				       &tmp, &sz) < 0)
+				       &tmp, &sz, 1024) < 0)
 		return -1;
 
 	/* Hack: With some ld versions (GNU ld version 2.14.90.0.4 20030523),
Index: kexec-tools-bw/kexec/crashdump-elf.c
===================================================================
--- kexec-tools-bw.orig/kexec/crashdump-elf.c	2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/crashdump-elf.c	2007-02-13 17:39:26.000000000 +0900
@@ -27,11 +27,11 @@
 int FUNC(struct kexec_info *info,
 	 struct crash_elf_info *elf_info,
 	 struct memory_range *range, int ranges,
-	 void **buf, unsigned long *size)
+	 void **buf, unsigned long *size, unsigned long align)
 {
 	EHDR *elf;
 	PHDR *phdr;
-	int i, sz, align;
+	int i, sz;
 	char *bufp;
 	long int nr_cpus = 0;
 	uint64_t notes_addr, notes_len;
@@ -72,13 +72,6 @@
 		sz += sizeof(PHDR);
 	}
 
-	/*
-	 * The kernel command line option memmap= requires 1k granularity,
-	 * therefore we align the size to 1024 here.
-	 */
-
-	align = 1024;
-
 	sz += align - 1;
 	sz &= ~(align - 1);
 
Index: kexec-tools-bw/kexec/crashdump.h
===================================================================
--- kexec-tools-bw.orig/kexec/crashdump.h	2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/crashdump.h	2007-02-13 17:39:26.000000000 +0900
@@ -27,12 +27,14 @@
 int crash_create_elf32_headers(struct kexec_info *info,
 			       struct crash_elf_info *elf_info,
 			       struct memory_range *range, int ranges,
-			       void **buf, unsigned long *size);
+			       void **buf, unsigned long *size,
+			       unsigned long align);
 
 int crash_create_elf64_headers(struct kexec_info *info,
 			       struct crash_elf_info *elf_info,
 			       struct memory_range *range, int ranges,
-			       void **buf, unsigned long *size);
+			       void **buf, unsigned long *size,
+			       unsigned long align);
 
 int xen_present(void);
 int xen_get_nr_phys_cpus(void);





More information about the fastboot mailing list