Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YbVG2-0003ym-1s for mharc-grub-devel@gnu.org; Fri, 27 Mar 2015 10:29:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbVFz-0003y3-Bw for grub-devel@gnu.org; Fri, 27 Mar 2015 10:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbVFw-0004dk-57 for grub-devel@gnu.org; Fri, 27 Mar 2015 10:29:07 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:43108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbVFv-0004de-Uc for grub-devel@gnu.org; Fri, 27 Mar 2015 10:29:04 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t2RESqYa001549 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 Mar 2015 14:28:52 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t2RESqRH020974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 27 Mar 2015 14:28:52 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t2RESpTd015388; Fri, 27 Mar 2015 14:28:51 GMT Received: from olila.local.net-space.pl (/10.175.231.232) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 27 Mar 2015 07:28:51 -0700 Date: Fri, 27 Mar 2015 15:28:44 +0100 From: Daniel Kiper To: Jan Beulich Subject: Re: [PATCH 17/18] x86/efi: create new early memory allocator Message-ID: <20150327142844.GQ8294@olila.local.net-space.pl> 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> <55156A9F020000780006E928@mail.emea.novell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55156A9F020000780006E928@mail.emea.novell.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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 14:29:08 -0000 On Fri, Mar 27, 2015 at 01:35:11PM +0000, Jan Beulich wrote: > >>> 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 == NULL ) > >> > + __malloc_free = __malloc_mem; > >> > + > >> > + ptr = __malloc_free; > >> > + > >> > + __malloc_free += 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. > > > > 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... > > > >> > @@ -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 -= *map_size; > >> > - mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR); > > > > ...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). > > > > So, go or no go this route? > > As long as it's being done properly, I'm not wildly opposed. So, AIUI, general idea is OK but fix all stuff which should be fixed. Right? Daniel