I am working with affinities in order to start and bind various components on different cores.

I am using QEMU as emulation platform to start the system with four cores.

My situation looks as follows:

I have one parent component which creates two more children. Each of these including the init component should be assigned to a different core.

The idea was to start init with an affinity configuration 4x1 in the run script:

=> <affinity-space width="4" height="1"/>


The custom parent component should be configured to get a affinity subspace of 3x1 beginning from the second core like:

=> <affinity xpos="1" ypos="0" width="3" height="1"/>


The next idea was to create two affinities with a subspace of 1x1 for the two children and start them within the parent component.

The two children should be working on the third and fourth core respectively, so my intention was to declare them as xpos 1 and 2 relative to the parents subspace of 3x1:

=> const Genode::Affinity &aff_count{Genode::Affinity::Space(1), Genode::Affinity::Location(1, 0)};
=> const Genode::Affinity &aff_val{Genode::Affinity::Space(1), Genode::Affinity::Location(2, 0)};

To check this attempt i inserted a log call in the constructor of core's Cpu_session_component:
=> log("CORE ",__func__,": Affinity location: xpos: ",_location.xpos()," ypos: ",_location.ypos()," width: ",_location.width()," height: ",_location.height());



The log outputs seem relatively coherent with what was originally planned:

=> init cpu_session:         "CORE Cpu_session_component:  Affinity location: xpos: 0 ypos: 0 width: 4 height: 1"

=> parent cpu_session:   "CORE Cpu_session_component:  Affinity location: xpos: 1 ypos: 0 width: 3 height: 1"

=> child_1 cpu_session: "CORE Cpu_session_component:  Affinity location: xpos: 2 ypos: 0 width: 3 height: 1"

=> child_2 cpu_session: "CORE Cpu_session_component:  Affinity location: xpos: 3 ypos: 0 width: 3 height: 1"


Unfortunately right after the second child gets started, the program loops and does not terminate.

If i change the affinity for the children to

=> const Genode::Affinity &aff_count{Genode::Affinity::Space(1), Genode::Affinity::Location(0, 0)};
=> const Genode::Affinity &aff_val{Genode::Affinity::Space(1), Genode::Affinity::Location(1, 0)};


the log outputs also change to

=> child_1 cpu_session: "CORE Cpu_session_component:  Affinity location: xpos: 1 ypos: 0 width: 3 height: 1"

=> child_2 cpu_session: "CORE Cpu_session_component:  Affinity location: xpos: 2 ypos: 0 width: 3 height: 1"


and the program continues its work as intended.


If you could tell me my thinking errors, if there are any, or how to achieve that each component gets assigned to their respective cores, i would appreciate it a lot.


--


Thank you,

Stephan Lex