public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Early malloc() summary
Date: Tue, 14 Aug 2012 14:37:29 +0200	[thread overview]
Message-ID: <201208141437.29415.marex@denx.de> (raw)
In-Reply-To: <CAEB7QLB5GHqvC_s7aPxeMe2hHOrgL4b9f4qq-2RAPesUiWpf=A@mail.gmail.com>

Dear Tomas Hlavacek,

> Hello Marek,
> 
> On Sun, Aug 12, 2012 at 1:16 AM, Marek Vasut <marex@denx.de> wrote:
> > So ... we should aim for firing up the real mallocator as soon as
> > possible and maybe implement discontigmem (sparsemem) into it, so we
> > don't have to bother with relocating pointers maybe?
> > 
> > The only problem I see is platforms where the memory disappears.
> 
> I doubt that on ARM for instance you can set off real mallocator that
> early without completely rewriting it.

Esp. on ARM, I won't see much of a problem. You usually have some small SRAM 
where such allocator could run.

> The idea of having one complex
> mallocator working in the same manner in board_init_f and board_init_r
> stages, being able to operate on all platforms using their nifty
> memory-management/model features

Do you need them? You usually need only a piece of RW memory.

> and being seamless to users is really
> tempting. But do we need/want to introduce such deep rewrites?

Deep rewrites? You'd only need to implement sparsemem into it, which might be 
list of RW memory areas instead of one memory area.

> What
> would be the justification? I would say we should stick with the
> Wolfgang's opinion: Create small and efficient early_malloc for DM and
> prepare it for future extensions and possible reuses.

dm_malloc you mean? I'm not happy about it, maybe Graeme can pour in some crazy 
juice in our direction again?

> >> Switching the focus back to DM, I really would like to ask to delay
> >> alls uch activities until DM has been done (or at least has stabilized
> >> so far that we can affort the luxury of thinking about the next
> >> version with fancy extensions).
> > 
> > We still need to handle the pre-reloc drivers somehow, you know ... but I
> > still believe we can pull the DM internals in three people and leave
> > Thomas to do proper malloc stuff ...
> 
> Yes, this is the main question: Should I hack malloc() function or
> does it make sense to have both early_malloc() and malloc() exposed to
> DM cores/drivers?

This is indeed the main question -- ideas ?

> The first is better from the point of view of drivers - when you ask
> for memory, you get it. But you have to check yourself whether you
> need to relocate your pointers or not, though we can provide
> "relocation chain" you can register your relocation routine into to
> facilitate it. The later makes sense because this makes it explicit
> that whenever you use early_malloc() you are responsible for
> relocating your data on your own (again, we can provide some facility
> for ir).
> 
> There is a third path possible: We can provide early_malloc() and say
> wrapped_malloc() which can be the third function "give me memory, I do
> not care whether it is early or not". So drivers and/or DM can choose
> to use malloc routines working in early-only, late-only or both.
> 
> Tomas

Best regards,
Marek Vasut

  reply	other threads:[~2012-08-14 12:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09  0:55 [U-Boot] Early malloc() summary Graeme Russ
2012-08-09 12:48 ` Wolfgang Denk
2012-08-11 23:16   ` Marek Vasut
2012-08-14  8:11     ` Tomas Hlavacek
2012-08-14 12:37       ` Marek Vasut [this message]
2012-08-14 13:08         ` Albert ARIBAUD
2012-08-14 14:40           ` Marek Vasut
2012-08-14 13:54         ` Graeme Russ
2012-08-14 14:00           ` Marek Vasut
2012-08-16 11:25             ` Graeme Russ
2012-08-16 14:52               ` Marek Vasut
2012-08-16 23:05                 ` Graeme Russ
2012-08-14 23:56           ` Marek Vasut
2012-08-16 11:39             ` Graeme Russ
2012-08-15 12:00           ` Tomas Hlavacek
2012-08-16 11:56             ` Graeme Russ
2012-08-16 14:50               ` Marek Vasut
2012-08-16 23:03                 ` Graeme Russ
2012-08-16 23:32                   ` Marek Vasut
2012-08-16 23:50                     ` Graeme Russ
2012-08-17  0:34                       ` Marek Vasut
2012-08-17  1:15                         ` Graeme Russ
2012-08-19 13:21                           ` Tomas Hlavacek
2012-08-19 23:47                             ` Graeme Russ

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=201208141437.29415.marex@denx.de \
    --to=marex@denx.de \
    --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