All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IA64: kexec allocates too few memory for kdump kernel itself
@ 2008-09-03 21:01 Jay Lan
  2008-09-04  0:01 ` Simon Horman
  0 siblings, 1 reply; 8+ messages in thread
From: Jay Lan @ 2008-09-03 21:01 UTC (permalink / raw)
  To: kexec

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

Sometimes the kexec would allocate not enough memory for kdump kernel
itself on IA64 and caused kdump kernel to panic at boot.

When it happens, the /proc/iomem would show a kernel RAM segment like
this:
3014000000-3015294fff : System RAM
  3014000000-3014823ccf : Kernel code
  3014823cd0-3014dee8ef : Kernel data
  3014dee8f0-301529448f : Kernel bss
3015295000-307bffdfff : System RAM
  3018000000-3037ffffff : Crash kernel

But kexec would allocate memory 3018000000-3019290000 for the kernel,
which is 0x5000 smaller than the regular kernel. In my cases, the
physical_node_map and kern_memmap of the kdump kernel overlaped and
caused data corruption.

This patch fixes the problem. The patch was generated against
kexec-tools 2.0.0 and tested in 2.6.27-rc4.

Signed-off-by: Jay Lan <jlan@sgi.com>


[-- Attachment #2: bootmem-fix --]
[-- Type: text/plain, Size: 1030 bytes --]

---
 kexec/arch/ia64/crashdump-ia64.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: kexec-tools/kexec/arch/ia64/crashdump-ia64.c
===================================================================
--- kexec-tools.orig/kexec/arch/ia64/crashdump-ia64.c	2008-09-03 11:24:14.289758063 -0700
+++ kexec-tools/kexec/arch/ia64/crashdump-ia64.c	2008-09-03 11:29:34.095833316 -0700
@@ -90,15 +90,15 @@ static void add_loaded_segments_info(str
 			phdr = &ehdr->e_phdr[i];
 	                if (phdr->p_type != PT_LOAD)
 	                        break;
-			if (loaded_segments[loaded_segments_num].end !=
-				phdr->p_paddr & ~(ELF_PAGE_SIZE-1))
-				break;
+			if (loaded_segments[loaded_segments_num].end <
+			    (phdr->p_paddr & ~(ELF_PAGE_SIZE-1)) )
+				loaded_segments[loaded_segments_num].end
+				  = phdr->p_paddr & ~(ELF_PAGE_SIZE-1);
 			loaded_segments[loaded_segments_num].end +=
 				(phdr->p_memsz + ELF_PAGE_SIZE - 1) &
 				~(ELF_PAGE_SIZE - 1);
 			i++;
 		}
-
 		loaded_segments_num++;
 	}
 }

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-09-15  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-03 21:01 [PATCH] IA64: kexec allocates too few memory for kdump kernel itself Jay Lan
2008-09-04  0:01 ` Simon Horman
2008-09-04  1:37   ` Jay Lan
2008-09-04 18:28     ` Jay Lan
2008-09-12 23:27       ` Simon Horman
2008-09-13  0:38         ` Jay Lan
2008-09-15  5:47           ` Simon Horman
2008-09-15  6:58       ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.