Using Fiasco L4re APIs
Norman Feske
norman.feske at ...1...
Thu Mar 17 17:37:28 CET 2011
Hello Daniel,
> I'd like to be able to use the native Fiasco.OC L4re APIs (actually to
> set thread affinity) from within my Genode application. Its not clear
> to me how to set up the target.mk to do such things.
Genode is not built upon L4re. It is using only the Fiasco.OC kernel
bindings (called l4sys) and two other small components of L4re, namely
sigma0 and bootstrap. Logically, both sigma0 and bootstrap actually
belong to the kernel but they are contained in the L4re source tree for
historical reasons.
It is not possible to intermix L4re and Genode code but of course, you
can issue Fiasco.OC system calls by including the corresponding kernel
bindings. See 'base-foc/src/base/ipc/ipc.cc' as an example. As you can
see in this library code, we use to include Fiasco.OC header files into
the dedicated C++ namespace 'Fiasco'. I would recommend you to do the same.
Setting the thread affinity is not yet supported though Genode's API
because until recently, we used Genode with SMP only on Codezero and
Linux, both handling the thread affinity transparently. However, there
are two natural ways to support Fiasco.OC's explicit assignment of
thread affinities, as session-construction argument for CPU sessions or
by adding a 'set_affinity' function to Genode's 'Cpu_session' interface.
Both variants were successfully prototyped for Pistachio but have not
been merged with the official Genode API.
Personally, I have a preference to specifying the affinity as CPU
session argument such that all threads of this session are implicitly
bound to the specified CPU. This enables the assignment of complete
Genode subsystems to a specific CPU. Also it would preserve the notion
of having a "CPU session". Furthermore, the affinity would be subjected
to session policies imposed by the process hierarchy (similar to how RT
priorities are handled now) - affinities could be "virtualized". In
contrast, by adding a 'set_affinity' call to the 'Cpu_session'
interface, different threads of one CPU session could be bound to
different CPUs.
In both cases, the propagation of the thread affinity to the Fiasco.OC
kernel must happen within Genode's core by submitting the affinity as
argument when creating a new thread (at
'base-foc/src/core/platform_thread.cc').
Which variant of setting the affinity would make more sense from your
perspective?
Best regards
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
http://www.genode-labs.com · http://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
More information about the users
mailing list