[U-Boot] early_malloc outline

Wolfgang Denk wd at denx.de
Tue Aug 7 23:07:09 CEST 2012


Dear Tomas,

In message <CAEB7QLAnaNoTLQFzPaJ2NMgnDPv6QiNCzNTVBz6fhg2Yv99ctg at mail.gmail.com> you wrote:
> Dear Wolfgang,
> 
> On Wed, Aug 1, 2012 at 9:09 PM, Wolfgang Denk <wd at denx.de> wrote:
> 
> > Hm... I have to admit that I am not really happy about such an
> > "explanation".  The statement that "other guys" want something is not
> > exactly an explanation of a concept that I can understand, and without
> > being able to understand it, I don't buy it.
> 
> I wanted to say that this is outcome of an informal discussion with
> Marek Vasut, Pavel Hermann and Viktor Krivak, who are working on
> different parts of DM (and perhaps I should say that it is our school
> project to implement driver model for U-Boot, which is not relevant
> information to the current discussion, but it may explain why we
> closely cooperate on DM among ourselves). Statements like "I/we want"
> were not any notices nor decisions nor whatever final but rather
> wishes or ideas (mine or from others). Although we have elaborate
> outline of DM and supporting subsystems it is still subject to
> changes.

As long as you don't actually EXPLAIN the rationale behind any
suggestions or decisions, it is impossible to comment (otherwise we
run the rist to repeat all your previous discussions, and this would
be just a waste of time).

So please explain your concepts, and the rationale.

> Each early heap (assuming we can have more than one contiguous early
> heaps as Graeme suggested) has a pointer to the beginning (and it is
> valid only before relocation and before caches are enabled). I can
> memcpy() the used part of the early heap somewhere else and preserve
> the original heap beginning pointer (I have in mind preservation of
> the pointers in GD; it is implementation detail indeed, but I would
> rather note this in order make sure that I am not working with false
> assumption about possibility of preserving pointers like that). Then I
> can compute copied_heap_address = original_address +
> (copied_heap_begin - original_heap_begin).

Sure you can copy the content.

But "relocation" means that you have to add the address difference
(aka relocation offset) to _all_ pointers pointing into this area.
And there is no way to keep track of _all_ such pointers.


I am convinced that you _cannot_ reliably relocate the malloc arena if
you use the standard malloc//calloc/free interface for early
allocation.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No problem is insoluble.
	-- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4


More information about the U-Boot mailing list