[okl4-developer] okl4fs

Adam Clench adamc at ok-labs.com
Fri May 9 12:09:04 EST 2008


Hi Remy,

The okl4fs module is indeed used for inter-vm communications. It allows you
to create a bi-directional fifo-like channel between OK Linux and another
VM, presumably a native OKL4 application. This is useful in situations when
IPC is unsuitable, for example if you want to transfer long messages or lots
of raw data between VMs.

The general procedure for using the channel is very simple:

1. Perform a mknod call to create a new fifo file.
2. Open the new file.
3. Read and write like you would with a normal fifo.

To see exactly what is going on, there are a few places to look. The first
is the okl4fs kernel module in OK Linux (arch/l4/kernel/fs/okl4fs). It
doesn't do much - it is really just a wrapper around the real okl4fs code
which resides in the fs library in OKL4.

Secondly, there is the fs library itself (libs/fs). The main points of
interest here are read/write, socketpair and memsec_malloc. Intervm
communication is built on the intra-VM pipe/socketpair functionality as it
is conceptually very similar - the only difference is that the two virtual
machines must share a common memory region and data structures. The
socketpair code does the initial setup of the data structures, and uses
memsec_malloc instead of the standard malloc to ensure that they are
allocated from the region of memory that is shared between the VMs.

The hardest part is actually configuring the channel at build time. It is
backed by several memsections which are shared between the VMs. These are
configured on the OKL4 side - see the intervm example (in iguana/examples)
for a simple example of how this works. There are three memsections - one
for communicating in each direction and another that is where all the shared
control information (data structures and mutexes) is stored. Note that the
two data memsections must be the same size but the control memsection can be
different.

The intervm channel is still a prototype so it has several limitations.
Firstly, there can only be one channel in the system . Secondly, each end of
the channel can only be opened by one thread/process at a time. Finally, the
file name that refers to the channel is hardcoded to "intervm_test" (so the
file name must be "intervm_test" when calling mknod).

I hope that helped. If you have any more questions, please ask.

Cheers,
Adam


Remy Gottschalk wrote:
> 
> Hello all,
> 
> Looking at the filesystems I just seen that with version 2.1 appears in
> wombat a directory named okl4 which is mounted from /dev/ram1 with fs
> type being okl4fs.
> Digging a little it seems that it is related to inter-vm communications.
> So it'd be nice if you could tell me a little about it and the wonderful
> things we can do with it :).
> 
> 
> -- 
> Remy Gottschalk - rgottschalk at linagora.com
> Ingénieur informatique embarquée
> Groupe LINAGORA - http://www.linagora.com
> Tél.: +33(0)1 58 18 68 28 - Fax : +33(0)1 58 18 68 29
> 
> 
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
> 
> 

-- 
View this message in context: http://www.nabble.com/okl4fs-tp17101106p17140219.html
Sent from the OKL4 Community mailing list archive at Nabble.com.




More information about the Developer mailing list