Skip to contentSkip to conversation

IA64 kexec-tools: efi_memmap overflow on large systems

PATCH In review Jay Lan 2 participants 2 messages Feb 1, 2007

lore
Share & tools
lore

Jay Lan

author
#0 lore raw

PATCH 1/1 IA64 kexec-tools: efi_memmap overflow on large systems

This patch fixes a efi_memmap overflow problem on large system. Currently the kexec allocates statically 16k buffer to contain efi_memmap. It can hold about 333 entries. It causes data corruption on large system.

This patch would let kexec allocate the efi_memmap at run time using the actual size allocated in the production kernel.

kexec/arch/ia64/kexec-elf-ia64.c +3 -2
Index: kexec-tools-testing-20061214/kexec/arch/ia64/kexec-elf-ia64.c
===================================================================
@@ -47,6 +47,7 @@
 #include <arch/options.h>
 
 static const int probe_debug = 0;
+extern unsigned long saved_efi_memmap_size;
 
 /*
  * elf_ia64_probe - sanity check the elf image
@@ -229,8 +230,8 @@ int elf_ia64_load(int argc, char **argv,
         elf_rel_set_symbol(&info->rhdr, "__boot_param_base",
                         &boot_param_base, sizeof(long));
 
-	// reserve 8k for efi_memmap
-	efi_memmap_size = 1UL<<14;
+	// reserve efi_memmap of actual size allocated in production kernel
+	efi_memmap_size = saved_efi_memmap_size;
 	efi_memmap_buf = xmalloc(efi_memmap_size);
 	efi_memmap_base = add_buffer(info, efi_memmap_buf,
 			efi_memmap_size, efi_memmap_size, 4096, 0,
kexec/arch/ia64/kexec-ia64.c +2 -0
Index: kexec-tools-testing-20061214/kexec/arch/ia64/kexec-ia64.c
===================================================================
@@ -38,6 +38,7 @@
 
 static struct memory_range memory_range[MAX_MEMORY_RANGES];
 static int memory_ranges;
+unsigned long saved_efi_memmap_size;
 
 /* Reserve range for EFI memmap and Boot parameter */
 static int split_range(int range, unsigned long start, unsigned long end)
@@ -124,6 +125,7 @@ int get_memory_ranges(struct memory_rang
 			continue;
 		} else if (memcmp(str, "EFI Memory Map\n", 14) == 0) {
 			memory_ranges = split_range(memory_ranges, start, end);
+			saved_efi_memmap_size = end - start;
 			continue;
 		} else
 			continue;
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Jay Lan [mailto:[email protected]]
Sent: 2007Äê2ÔÂ1ÈÕ 9:54
To: fastboot
Cc: Linux-IA64; Zou, Nanhai
Subject: [PATCH] IA64 kexec-tools: efi_memmap overflow on large systems

This patch fixes a efi_memmap overflow problem on large system. Currently the kexec allocates statically 16k buffer to contain efi_memmap. It can hold about 333 entries. It causes data corruption on large system.

Quoted 5 lines

This patch would let kexec allocate the efi_memmap at run time using the actual size allocated in the production kernel.

Another hardcode limit needs to be eliminated, the CRASH_MAX_MEMORY_RANGE in crashdump-ia64.c. Since SN systems may scale to hundreds of nodes, each node may contain up to 12 DIMMs.

I guess the current 1024 limit is not enough for those super computers.

So we need to count crash memory ranges from /proc/iomem and allocated crash_memory_range dynamically.

Thanks
Zou Nan hai