From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Fri, 24 Apr 2020 13:27:56 -0400 Subject: [PATCH] dlmalloc: Add an option to default malloc to init In-Reply-To: <20200421110039.GB7613@marek-VirtualBox> References: <20200318121443.14064-1-marek.bykowski@gmail.com> <20200320182711.GF5793@bill-the-cat> <20200421110039.GB7613@marek-VirtualBox> Message-ID: <20200424172756.GG4555@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Apr 21, 2020 at 01:00:41PM +0200, Marek wrote: > > > > Can you please showcase using this feature somewhere? Thanks! > > > > -- > > Tom > > Yes. First of all, sincere apology for such a massive delay in it. > I got snowed with the corporation work of mine. > > So here is my go at showcasing it. We are in SPL U-Boot running code from > within the static memory: > arch/arm/cpu/armv8/start.S:reset vector > -> arch/arm/cpu/armv8/start.S:main() > -> arch/arm/lib/crt0_64.S:board_init_f() > -> /board//common/spl.c:board_init_f() > > board_init_f() does mem_malloc_init(malloc_start_in_static, size). It needs > the malloc for SPI flash to load off some proprietary stuff. > Note the size of the static memory is limited, so is our malloc size. > > Then along it does the DDR memory initialization. Now we have much greater memory > and can move our malloc allocator onto it. So again it does mem_malloc_init() > but this time with an address in the DDR memory and a much greater size. > And this is where this feature comes in hand. Just calling in mem_malloc_init() > with the updated start addr and the size isn't enough. It also mandates > resetting the malloc, namely defaulting its bins, and some bookkeeping. > > I know there is an early malloc available I can use as the first one but that > requires managing the two mallocs. This patch proposes to use a single malloc > suite (dlmalloc) and use it freely around when and how it is needed. OK, thanks. Can you please re-send and include the above re-phrased to make sense in a commit message, in the body of the commit as well so it's documented more in-tree when this would be helpful? Thanks again! > > Marek -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: