From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Tripathy Subject: Re: Can't see more than 3.5GB of RAM / UEFI / no e820 memory map detected Date: Tue, 28 Aug 2012 23:05:54 +0100 Message-ID: <503D40C2.6040407@abpni.co.uk> References: <503D3D2E.70103@abpni.co.uk> <503D3DA8.3070002@abpni.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <503D3DA8.3070002@abpni.co.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 28/08/2012 22:52, Jonathan Tripathy wrote: > On 28/08/2012 22:50, Jonathan Tripathy wrote: >> >> >> On 28/08/2012 22:41, Keir Fraser wrote: >>> On 28/08/2012 22:13, "Jonathan Tripathy" wrote: >>> >>>> Keir Fraser wrote: >>>>> On 28/08/2012 20:36, "Jonathan Tripathy" wrote: >>>>> >>>>>>>> Thanks for the clarification. >>>>>>>> >>>>>>>> So from a security/reliability standpoint, nothing will be >>>>>>>> affected by >>>>>>>> flipping the if block? >>>>>>> It should simply make it more likely that Xen sees all your RAM. ;) >>>>>>> >>>>>>> -- Keir >>>>>>> >>>>>>> >>>>>> Hi Everyone, >>>>>> >>>>>> I reversed the if block in setup.c and now my server can see the >>>>>> full >>>>>> 32GB of RAM. I haven't submitted a patch yet as we have run into >>>>>> another >>>>>> (possibly unrelated to xen) issue with this server build that we are >>>>>> working on. Once we complete our full testing, a patch will be >>>>>> submitted :) >>>>> In this case, I will re-make the patch myself and check it in. >>>>> Since it is a >>>>> trivial one. >>>>> >>>>> Thanks, >>>>> Keir >>>> Thanks Keir >>> Now done. xen-unstable:25786 >>> >>> -- Keir >> Hi Keir, >> >> Thanks for doing that. However, the ordering of the if block in my >> code that I used was slightly different from your commit. Perhaps >> this doesn't make too much of a difference? >> >> Thanks >> > Ooops, typo'd the code (I had to recreate the changes as I deleted my > source tree). Here is the version I used: > > if ( mbi->flags & MBI_MEMMAP ) > { > memmap_type = "Multiboot-e820"; > while ( (bytes < mbi->mmap_length) && (e820_raw_nr < E820MAX) ) > { > memory_map_t *map = __va(mbi->mmap_addr + bytes); > > /* > * This is a gross workaround for a BIOS bug. Some > bootloaders do > * not write e820 map entries into pre-zeroed memory. This is > * okay if the BIOS fills in all fields of the map entry, but > * some broken BIOSes do not bother to write the high word of > * the length field if the length is smaller than 4GB. We > * detect and fix this by flagging sections below 4GB that > * appear to be larger than 4GB in size. > */ > if ( (map->base_addr_high == 0) && (map->length_high != 0) ) > { > if ( !e820_warn ) > { > printk("WARNING: Buggy e820 map detected and fixed " > "(truncated length fields).\n"); > e820_warn = 1; > } > map->length_high = 0; > } > > e820_raw[e820_raw_nr].addr = > ((u64)map->base_addr_high << 32) | > (u64)map->base_addr_low; > e820_raw[e820_raw_nr].size = > ((u64)map->length_high << 32) | (u64)map->length_low; > e820_raw[e820_raw_nr].type = map->type; > e820_raw_nr++; > > bytes += map->size + 4; > } > } > else if ( mbi->flags & MBI_MEMLIMITS ) > { > memmap_type = "Multiboot-e801"; > e820_raw[0].addr = 0; > e820_raw[0].size = mbi->mem_lower << 10; > e820_raw[0].type = E820_RAM; > e820_raw[1].addr = 0x100000; > e820_raw[1].size = mbi->mem_upper << 10; > e820_raw[1].type = E820_RAM; > e820_raw_nr = 2; > } > else if ( e820_raw_nr != 0 ) > { > memmap_type = "Xen-e820"; > } > else if ( bootsym(lowmem_kb) ) > { > memmap_type = "Xen-e801"; > e820_raw[0].addr = 0; > e820_raw[0].size = bootsym(lowmem_kb) << 10; > e820_raw[0].type = E820_RAM; > e820_raw[1].addr = 0x100000; > e820_raw[1].size = bootsym(highmem_kb) << 10; > e820_raw[1].type = E820_RAM; > e820_raw_nr = 2; > } > else > { > EARLY_FAIL("Bootloader provided no memory information.\n"); > } > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel Anyway, question is moot. I rebuilt my code using your ordering of the if block and it works just fine. All 32GB is detected. I actually agree with your order because as you as, 801 is outdated.