Share exist memory over IPC with L4Re

Alexander Fratzer alexander.fratzer at gmail.com
Mon May 15 15:17:57 CEST 2017


Dear L4-Hackers,
I have a very simple problem but I can't find the solution in the 
L4Re-Doc and examples so far. I wrote a very simple Unix-Like Shell with
a Filesystem-Server and a Loader-Server and I implemented some 
Posix-Call as an abstraction for the communication with the
Filesystem-Server (virtual). Now I have a problem of double copies for a
read-Operation. I want a complete abstraction from the L4Re mechanisms 
and the underlying Client-Server architecture for the usage of this 
interface. The (bad) mechanism is as follow:

Function (client side):
	ssize_t read(int fd, void *buf, size_t count)

Algorithm:
	1. Allocate Dataspace with size of count.
	2. Send Cap of Dataspace to the Filesystem-Server.
	3. Copy content of Dataspace to buf.
	4. Cleanups.

Function (server side):
	long VFSSrv::op_file_read(VFS::Rights, TaskRegistry::TaskId task, 
TaskRegistry::FileDescriptor fd, size_t size, L4::Ipc::Snd_fpage& flexp, 
size_t& rsize)

Algorithm:
	1. Get Dataspace-Cap from Ipc-fpage.
	2. Reserve area with Region-Manager.
	3. Attach Dataspace to the area.
	4. Copy content of the file to the attached area.
	5. Cleanups.

This was my first working solution without focus on runtime but
the creation of a new task from an ELF-File of 1.4 MB size takes
20 seconds on Cortex A8. This suxx so I have to optimize.
Therefor I need a way to share the content of my file (virtual, heap 
allocated memory) without copying to the client but i don't find a way 
to share exist memory over IPC. I think I'm using the 
Dataspace-mechanism in a wrong way but maybe a Dataspace isn't the right 
choice in my case. A simple solution would be a new Filesystem which is 
based on Dataspaces but I don't want to do this. Have anybody a better idea?

Thanks for help.
Best regards Alex.



More information about the l4-hackers mailing list