public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek <marek.bykowski@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH] dlmalloc: Add an option to default malloc to init
Date: Tue, 21 Apr 2020 02:21:36 +0200	[thread overview]
Message-ID: <20200421002134.GB5655@marek-VirtualBox> (raw)
In-Reply-To: <20200320182711.GF5793@bill-the-cat>

>
> Can you please showcase using this feature somewhere?  Thanks!
>

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/<my_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.

Marek

  reply	other threads:[~2020-04-21  0:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 12:14 [PATCH] dlmalloc: Add an option to default malloc to init marek.bykowski at gmail.com
2020-03-20 18:27 ` Tom Rini
2020-04-21  0:21   ` Marek [this message]
2020-04-21 10:54     ` Marek
2020-04-21 11:00   ` Marek
2020-04-24 17:27     ` Tom Rini
2020-04-24 23:19       ` Marek Bykowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200421002134.GB5655@marek-VirtualBox \
    --to=marek.bykowski@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox