From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YbUPu-0007JY-Rs for mharc-grub-devel@gnu.org; Fri, 27 Mar 2015 09:35:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbUPs-0007JO-UW for grub-devel@gnu.org; Fri, 27 Mar 2015 09:35:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbUPp-0001fE-PC for grub-devel@gnu.org; Fri, 27 Mar 2015 09:35:16 -0400 Received: from mail.emea.novell.com ([130.57.118.101]:48607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbUPp-0001dj-HG for grub-devel@gnu.org; Fri, 27 Mar 2015 09:35:13 -0400 Received: from EMEA1-MTA by mail.emea.novell.com with Novell_GroupWise; Fri, 27 Mar 2015 13:35:12 +0000 Message-Id: <55156A9F020000780006E928@mail.emea.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.0.1 Date: Fri, 27 Mar 2015 13:35:11 +0000 From: "Jan Beulich" To: "Daniel Kiper" Subject: Re: [PATCH 17/18] x86/efi: create new early memory allocator References: <1422640462-28103-1-git-send-email-daniel.kiper@oracle.com> <1422640462-28103-18-git-send-email-daniel.kiper@oracle.com> <54F4AAB502000078000654ED@mail.emea.novell.com> <20150327125701.GL8294@olila.local.net-space.pl> In-Reply-To: <20150327125701.GL8294@olila.local.net-space.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 130.57.118.101 Cc: Juergen Gross , grub-devel@gnu.org, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, roy.franz@linaro.org, ning.sun@intel.com, david.vrabel@citrix.com, phcoder@gmail.com, xen-devel@lists.xenproject.org, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2015 13:35:18 -0000 >>> On 27.03.15 at 13:57, wrote: > On Mon, Mar 02, 2015 at 05:23:49PM +0000, Jan Beulich wrote: >> >>> On 30.01.15 at 18:54, wrote: >> > +{ >> > + void *ptr; >> > + >> > + /* >> > + * Init __malloc_free on runtime. Static initialization >> > + * will not work because it puts virtual address there. >> > + */ >> > + if ( __malloc_free =3D=3D NULL ) >> > + __malloc_free =3D __malloc_mem; >> > + >> > + ptr =3D __malloc_free; >> > + >> > + __malloc_free +=3D size; >> > + >> > + if ( __malloc_free - __malloc_mem > sizeof(__malloc_mem) ) >> > + blexit(L"Out of static memory\r\n"); >> > + >> > + return ptr; >> > +} >> >> You're ignoring alignment requirements here altogether. >=20 > I can understand why __malloc_mem should be let's say page aligned > but I am not sure why we should care here about alignment inside > of __malloc_mem array like... >=20 >> > @@ -192,12 +218,7 @@ static void __init >> > efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, >> > >> > static void *__init efi_arch_allocate_mmap_buffer(UINTN *map_size) >> > { >> > - place_string(&mbi.mem_upper, NULL); >> > - mbi.mem_upper -=3D *map_size; >> > - mbi.mem_upper &=3D -__alignof__(EFI_MEMORY_DESCRIPTOR); >=20 > ...here... Specifically with the later mentioned potential for sharing this with ARM I think you have to make sure that things are suitably aligned, or else you cause aborts. >> > - if ( mbi.mem_upper < xen_phys_start ) >> > - return NULL; >> > - return (void *)(long)mbi.mem_upper; >> > + return __malloc(*map_size); >> > } >> >> Which then even suggests that _if_ we go this route, this could be >> shared with ARM (and hence become common code again). >=20 > So, go or no go this route? As long as it's being done properly, I'm not wildly opposed. Jan