Using Fiasco L4re APIs

Daniel Waddington d.waddington at ...60...
Thu Mar 17 18:16:49 CET 2011

Hi Norman,
Yes, sorry I meant using the system calls rather than L4Re directly.

As far as design choice, I think you need both.  When you can use an 
affinity mask for a set of threads that belong to a single CPU session, 
then setting this mask through the CPU session works.  However, lets say 
you want to explicitly define each individual mapping of thread to 
core.  In this case you either need to be able to define the affinity 
from the thread, or some how build a map of threads-to-affinity in the 
CPU session.  The latter could be cleaner, but less conventional.

I did try to include the l4sys headers in my genode program, but it sort 
of blew up - it found the headers but not things like L4_PAGESHIFT.


On 03/17/2011 09:37 AM, Norman Feske wrote:
> 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 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/' 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/').
> Which variant of setting the affinity would make more sense from your
> perspective?
> Best regards
> Norman

More information about the users mailing list