From: "Jan Beulich" Subject: Re: [PATCH V4 03/15] create arch functions to get and process EFI memory map. Date: Fri, 12 Sep 2014 10:56:49 +0100 Message-ID: <5412DF810200007800034688@mail.emea.novell.com> References: <1410310325-4509-1-git-send-email-roy.franz@linaro.org> <1410310325-4509-4-git-send-email-roy.franz@linaro.org> <5411C99E0200007800033F2A@mail.emea.novell.com> <5412B7D602000078000344E2@mail.emea.novell.com> <1410515144.567.25.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410515144.567.25.camel@kazak.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: keir , tim , xen-devel , Roy Franz , Stefano Stabellini , Fu Wei List-Id: xen-devel@lists.xenproject.org >>> On 12.09.14 at 11:45, wrote: > On Fri, 2014-09-12 at 08:07 +0100, Jan Beulich wrote: >> >>> On 11.09.14 at 19:40, wrote: >> > On Thu, Sep 11, 2014 at 7:11 AM, Jan Beulich wrote: >> >>>>> On 10.09.14 at 02:51, wrote: >> >>> @@ -1171,67 +1169,12 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE > *SystemTable) >> >>> } >> >>> } >> >>> >> >>> - efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key, >> >>> - &efi_mdesc_size, &mdesc_ver); >> >>> - mbi.mem_upper -= efi_memmap_size; >> >>> - mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR); >> >>> - if ( mbi.mem_upper < xen_phys_start ) >> >>> - blexit(L"Out of static memory"); >> >>> - efi_memmap = (void *)(long)mbi.mem_upper; >> >>> - status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key, >> >>> - &efi_mdesc_size, &mdesc_ver); >> >>> - if ( EFI_ERROR(status) ) >> >>> - PrintErrMesg(L"Cannot obtain memory map", status); >> >>> + efi_arch_get_memory_map(&mmap_size, &mmap, &mmap_key, >> >>> + &mmap_desc_size, &mmap_desc_ver); >> >> >> >> The only arch-specific bit here is where to put the map. >> > Yes, but the ARM method of allocating the space can make the map >> > bigger. > > So something which ARM does can make the result of efi_bs->GetMemoryMap > longer? Or are we talking about the bootinfo.mem array? Not having looked at the code, I suppose the issue is with the sequence of - get memory map size - alloc memory for the map - get memory map where the middle step may alter the memory map size. But with any kind of sane allocator it ought to be reasonable to expect it to not grow by more than two entries (if the allocator chooses to take the middle of an existing free block), which could be accounted for up front. Jan