Hi Genodians,
I'm stuck with service routing. When I use the default routes the hello-application works. When I remove the default and create explicit routes for the ROM-service these fail. Here's my writeup:
I added this line to repos/os/src/init/child.cc: Init::Child::resolve_session_request( + log("child "", name(), "" resolves "", service_name, "" label [", label, "]");
It logs which child is resolving what service and label. With default routing, I get this output (for ROMs) in make run/hello:
Genode 18.05-203-gf4ea50c6f <local changes> [init] child "hello_client" resolves "ROM" label [hello_client] [init] child "hello_client" resolves "ROM" label [ld.lib.so] [init] child "hello_server" resolves "ROM" label [hello_server] [init] child "hello_server" resolves "ROM" label [ld.lib.so] [init] child "hello_server" resolves "ROM" label [hello_server -> config] [init] child "hello_client" resolves "ROM" label [hello_client -> config] [init] child "hello_server" resolves "ROM" label [hello_server -> session_requests] ... [init -> hello_client] hello test completed
So far so good.
However, when I take out the <default-route> entry and add explicit routes to hello.run for the hello-client serivce:
<route> <service name="PD"> <parent/> </service> <service name="CPU"> <parent/> </service> <service name="LOG"> <parent/> </service> <service name="Hello"> <child name="hello_server"/> </service> <service name="ROM" label="hello_client"> <parent/> </service> <service name="ROM" label="ld.lib.so"> <parent/> </service> <service name="ROM" label="hello_client -> config"> <parent/> </service> <service name="ROM" label="hello_client -> session_requests"> <parent/> </service> </route>
I get these errors: (skipping things that go well)
[init] child "hello_client" resolves "ROM" label [hello_client] [init] Warning: hello_client: no route to service "ROM" [init] Error: hello_client: ROM environment session denied ... [init] child "hello_client" resolves "ROM" label [ld.lib.so] [init] Warning: hello_client: no route to service "ROM" [init] Error: hello_client: ROM environment session denied ... Makefile:312: recipe for target 'run/hello' failed
What's happening here? Why are my explicit routes to the labels I find in the first log not working? How can I make explicit routes work for these services?
Cheers, Guido.
Hi Guido,
However, when I take out the <default-route> entry and add explicit routes to hello.run for the hello-client serivce:
<route> <service name="PD"> <parent/> </service> <service name="CPU"> <parent/> </service> <service name="LOG"> <parent/> </service> <service name="Hello"> <child name="hello_server"/> </service> <service name="ROM" label="hello_client"> <parent/> </service> <service name="ROM" label="ld.lib.so"> <parent/> </service> <service name="ROM" label="hello_client -> config"> <parent/> </service> <service name="ROM" label="hello_client -> session_requests"> <parent/> </service> </route>
I get these errors: (skipping things that go well)
[init] child "hello_client" resolves "ROM" label [hello_client] [init] Warning: hello_client: no route to service "ROM" [init] Error: hello_client: ROM environment session denied ... [init] child "hello_client" resolves "ROM" label [ld.lib.so] [init] Warning: hello_client: no route to service "ROM" [init] Error: hello_client: ROM environment session denied ... Makefile:312: recipe for target 'run/hello' failed
What's happening here? Why are my explicit routes to the labels I find in the first log not working? How can I make explicit routes work for these services?
The strings specified as values of a 'label' attribute are automatically prefixed with the name of the start node because those session requests normally originate from the component. So instead of specifying
<service name="ROM" label="hello_client -> session_requests"> <parent/> </service>
You just have to use
<service name="ROM" label="session_requests"> <parent/> </service>
The "hello_client" part would be redundant because the routes are defined in the context of "hello_client" already.
However, in contrast to regular routes like this, which are initiated by the child, the ROM sessions for the binary and the dynamic linker are initiated by the parent (on behalf of the child). Here, the automatic scoping of the label attributes cannot be used. To explicitly route those sessions, use the 'unscoped_label' or 'label_last' attributes.
For a description of the various label attributes in session routes, please refer to Section "6.2.1. Session routing" of the Genode Foundations book [1], in particular the part starting at page 176.
[1] https://genode.org/documentation/genode-foundations-18-05.pdf
Cheers Norman