Question about memory management in L4 Fiasco O.C + L4re

Adam Lackorzynski adam at
Wed Sep 30 23:39:41 CEST 2015


On Mon Sep 28, 2015 at 10:44:19 +0200, Mahdi Aichouch wrote:
> > An application is typically composed of multiple memory regions in
> > virtual memory. Do you mean you want all those regions to be physically
> > contiguous, such as text-segment, bss and stacks? This should be
> > possible by using a memory allocator that makes sure this is the case.
> > However, currently, there is only the possibility to have dataspaces
> > physicall contiguous.
> This exactly what I mean, that is, text-segment, bss, data, stack, and heap
> regions have to be contiguously allocated for Fiasco kernel, sigma0, moe,
> L4Linux, and for each created L4 task.
> My use case requires that each created L4 task has to be provided with a
> static fixed physical memory segment, and cannot exceed its allocated
> memory segment.

This is an interesting requirement. First what is to consider is that
there's a hierarchy of dependencies and that not all of the components
can be strictly separated. For example, sigma0 has all memory, so one
can make its text, data etc. contiguous but it also needs to give memory
to others, i.e. sharing it with them.
For anything running on moe you can give each application a specific
memory allocator that has exactly the size required. However, in the
allocator you'd need to make sure that it's all physically consecutive.
For Fiasco, sigma0 and moe you need to check separately whether it
already fulfills your needs or not.

> Currently the memory allocator is present in moe package, right?


> Thus, a new memory allocator should to be added to that package I guess,
> right?

Yes, moe is implementing the allocator and dataspaces for applications.
There's no such thing for Fiasco, sigma0 and moe as they actually build
up the functionality to have dataspaces.

> If not, could you please suggest a place in the code base where a new
> memory allocator has to be added.
> I would like to implement a mechanism that allow to know for each created
> L4 task which physical frame a virtual page is mapped to. The functionality
> provided by such a service are similar to
> pagemap [1] service in Linux kernel.

This is already available via the dataspace interface, given the memory
in the dataspace is allocated as 'pinned' (so that is cannot be moved
around by the implementor of the dataspace). See L4Re::Dataspace::phys

> Is such a service could be implemented at userspace in L4re?
> Does Fiasco O.C provide the necessary mechanism to implement it?
> If yes, could you please suggest a set functions that should be used.

For sigma0 and moe it is easier because they run identity mapped. In the
kernel there is also functionality to convert between virtual and
physical addresses, see the Mem_layout class.

Adam                 adam at

More information about the l4-hackers mailing list