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: Sun, 12 Aug 2012 01:16:06 +0200	[thread overview]
Message-ID: <201208120116.07059.marex@denx.de> (raw)
In-Reply-To: <20120809124843.17A54200167@gemini.denx.de>

Dear Wolfgang Denk,

> Dear Graeme Russ,
> 
> In message 
<CALButCL9btmPEW3Uiv9=tU4Yk7fdTUruzpCcVqMLynpzWv6Pug@mail.gmail.com> you wrote:
> > While the need for early malloc() came about from the driver model and
> > the desire to make drivers usable before relocation, I think we can all
> > agree that its scope may well not be limited to use by drivers. A few
> 
> > examples I can think of the top of my head include:
> I agree with all this,  but can we please stop this discussion here
> and now?

Why should we? We can still run the DM in three people and leave the malloc 
stuff offloaded to Thomas, as he is gaining good knowledge of this stuff.

Besides, the malloc goo is pretty separate part.

> The DM project is big and complicated enough, and I would really like
> that they can come up with a straightforward, simple and robust
> design.
> 
> Adding additional requirements to DM parts here and there will make
> this even more complex, and delay design and implementation.
> 
> Given that the project team is running under some resource
> constrictions (like we all do) we should try to help to get this
> implemented as quickly as possible, and not add more and more
> requirements that actually have nothing to do with DM.
> 
> I suggest we discuss such an extension separately, and ideally after
> the DM code has been merged mainline.
> 
> > So we all know the intent:
> >  - have the ability to allocate memory prior to relocation
> 
> Actually I see things different.
> 
> With the advent of SPL the strict barrier before/after relocation has
> started to crumble.  Already now we have systems which set up a "real"
> malloc arena and stack in RAM in the SPL, so they can use features
> (like file system support) at a stage that in our "pre/after" type of
> thinking would never allow it.
> 
> Initally I was not happy about this, and anly accepted it grudgingly,
> but the longer I think about it I tend to believe that we really
> should allow users such flexibility if their hardware allows it.
> Hardware configurations have become so manifold that we should allow
> to make maximum use of available features.
> 
> So we not only talk about malloc() before "relocation", but actually
> runnign arbitrary code.

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.

> > And we all know the problems:
> >  1. Preserving allocation references accross relocation
> >  2. Any given driver may need to use early malloc() on some boards but
> >  not
> >  
> >     on others
> 
> Again, I think we will have separate interfaces for malloc(0 and
> early_malloc().  Code that cannot be sure of it's runtime environment
> (like drivers) will have to provide proper provisions for a mode
> switch.  All other code should either "just work" (if standard
> malloc() is available under this name, then it is supposed to work),
> or break at build time (because f unresolved references to the
> malloc/calloc/free names).
> 
> > My thought: Keep it simple for now. Worry about optimising it to death
> > later.
> 
> 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 ...

> Thanks.
> 
> Best regards,
> 
> Wolfgang Denk

Best regards,
Marek Vasut

  reply	other threads:[~2012-08-11 23:16 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 [this message]
2012-08-14  8:11     ` Tomas Hlavacek
2012-08-14 12:37       ` Marek Vasut
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=201208120116.07059.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