[gPXE] [PATCH] Merge adjacent memory regions of same type
Silver, Geoffrey
Geoffrey.Silver at citadelgroup.com
Tue Nov 30 13:31:29 EST 2010
I'd like to state for the record that this patch resolves a specific gPXE issue on some HP BL685c G1 servers where a large boot image (eg. ESXi 4.1) runs through the available memory in the first region. It would be great if this patch would make it into gPXE 1.0.2.
--
Geoffrey Silver
Global Infrastructure
CITADEL
-----Original Message-----
From: gpxe-bounces at etherboot.org [mailto:gpxe-bounces at etherboot.org] On Behalf Of Casey Dahlin
Sent: Tuesday, October 12, 2010 3:37 PM
To: gpxe at etherboot.org
Cc: jeder at redhat.com; gcosta at redhat.com
Subject: [gPXE] [PATCH] Merge adjacent memory regions of same type
Some BIOSes can report multiple memory regions which may be adjacent and the same type. Since only the first region is used in the mboot.c32 layer it's possible to run out of memory when loading all of the boot modules. One may get around this problem by having gPXE merge these memory regions internally.
--- a/src/arch/i386/firmware/pcbios/memmap.c 2009-10-21 14:05:47.000000000 -0500
+++ b/src/arch/i386/firmware/pcbios/memmap.c 2010-08-27 17:27:45.000000000 -0500
@@ -156,6 +156,7 @@
*/
static int meme820 ( struct memory_map *memmap ) {
struct memory_region *region = memmap->regions;
+ struct memory_region *prev_region = NULL;
uint32_t next = 0;
uint32_t smap;
size_t size;
@@ -238,9 +239,16 @@
region->start = e820buf.start;
region->end = e820buf.start + e820buf.len;
- region++;
- memmap->count++;
-
+ /* Check for adjacent regions and merge them. */
+ if (prev_region && region->start == prev_region->end) {
+ prev_region->end = region->end;
+ }
+ else {
+ prev_region = region;
+ region++;
+ memmap->count++;
+ }
+
if ( memmap->count >= ( sizeof ( memmap->regions ) /
sizeof ( memmap->regions[0] ) ) ) {
DBG ( "INT 15,e820 too many regions returned\n" );
_______________________________________________
gPXE mailing list
gPXE at etherboot.org
http://etherboot.org/mailman/listinfo/gpxe
CONFIDENTIALITY AND SECURITY NOTICE
The contents of this message and any attachments may be confidential and proprietary and also may be covered by the Electronic Communications Privacy Act. This message is not intended to be used by, and should not be relied upon in any way, by any third party. If you are not an intended recipient, please inform the sender of the transmission error and delete this message immediately without reading, disseminating, distributing or copying the contents. Citadel makes no assurances that this e-mail and any attachments are free of viruses and other harmful code.
More information about the gPXE
mailing list