contiguous memory blocks and zero copy

Björn Döbel doebel at os.inf.tu-dresden.de
Thu Oct 9 19:12:01 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On 09.10.2014 18:57, teclis High Elf wrote:
> How does  L4Re handle contiguous memory blocks?

The dataspace managers (aka the user-level applications that provide
allocation and management of memory) provide the possibility to
allocate physically contiguous memory.

> What are the system calls used to allocate and manage contiguous
> memory?

The alloc() function of the Mem_alloc interface (provided e.g., by the
default memory allocator that you can access through
L4Re::Env::env()->mem_alloc) has a flags parameter. One of the flags
is the "Contiguous" flag, which asks the allocator for such memory.
See l4re/include/mem_alloc for docs.

> Is it possible to do zero copy data transfer between drivers and if
> so how is it done in Fiasco (so in linux world you would say no
> copy_to_user() and copy_from_user() )

Zero-copy transfer is possible if you have the same chunk of memory
mapped to both address spaces. For L4Re you would need to take the
following steps:

1. Allocate a memory dataspace. (Contiguous memory isn't strictly
   necessary.)
2. Give a capability to this dataspace to your two participants,
   let's call them tasks A and B.
3. In both A and B attach the dataspace using the region manager
   interface.

As a result of these three steps you will have shared memory between
the tasks and if one of the tasks writes to this memory, the other
task will see the results without further copying.

Besides the shared memory region, a real-life scenario will need means
for signalling between the partners. For an implementation of such
shared memory see l4/pkg/shmc.

Cheers,
Bjoern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlQ2wd4ACgkQP5ijxgQLUNn5FwCfawZ1+Raf3CQmgV+UjKFk5RkZ
78sAmwantOCHqgcHo5oCc9YgG+GOBEp9
=vZ8m
-----END PGP SIGNATURE-----



More information about the l4-hackers mailing list