Hi Genode-mailing-list,
i have a little problem with my ram and rm custom implementations.
When i try to create a child component which uses my custom sessions/services by running the following code:
int main(void) { PDBG("--- start proxy_server ---\n");
PDBG("--- announcing proxy services --- ");
Cap_connection cap;
static Sliced_heap sliced_heap(env()->ram_session(), env()->rm_session());
enum { STACK_SIZE = 8*1024 }; static Rpc_entrypoint ep(&cap, STACK_SIZE, "proxy_ep");
static Proxy::Prm_root prm_root(&ep, &ep, &sliced_heap); PDBG("PRM_root created and back in server-main!");
static Proxy::Pram_root pram_root(&ep, &ep, &sliced_heap); PDBG("PRAM_root created and back in server-main!");
env()->parent()->announce(ep.manage(&prm_root)); PDBG("PRM service announced!");
env()->parent()->announce(ep.manage(&pram_root)); PDBG("PRAM service announced!");
PDBG("--- starting test child ---");
/* Creating session for child environment */
static Rom_connection rom("proxy_test_client"); static Pd_connection pd; static Proxy::Pram_connection pram; <---------------- custom service, execution fails here. static Cpu_connection cpu; static Proxy::Prm_connection prm; <---------------- custom service static Cap_connection child_cap;
/* declaring ref account for child's ram session and transferring quota */
enum { CHILD_QUOTA = 1*1024*1024 }; pram.ref_account(env()->ram_session_cap()); env()->ram_session()->transfer_quota(pram.ram_cap(), CHILD_QUOTA);
/* creating test child */
Test_child proxy_test_child(rom.dataspace(), pd.cap(), pram.cap(), cpu.cap(), prm.cap(), &child_cap);
PDBG("--- proxy_server is going to sleep ---"); sleep_forever(); PDBG("Server still awake - This output should not be reached!");
return 0; }
I get this output:
Genode 15.11-71-g2e0e767 int main(): --- create local services --- int main(): --- start init --- int main(): transferred 112 MB to init int main(): --- init created, waiting for exit condition --- [init] Could not open ROM session for module "ld.lib.so" [init -> proxy_server] int main(): --- start proxy_server --- [init -> proxy_server] int main(): --- announcing proxy services --- [init -> proxy_server] Proxy::Prm_root::Prm_root(Genode::Rpc_entrypoint*, Genode::Rpc_entrypoint*, Genode::Allocator*): Creating Prm_root_component... [init -> proxy_server] int main(): PRM_root created and back in server-main! [init -> proxy_server] Proxy::Pram_root::Pram_root(Genode::Rpc_entrypoint*, Genode::Rpc_entrypoint*, Genode::Allocator*): Creating Pram_root_component... [init -> proxy_server] int main(): PRAM_root created and back in server-main! [init -> proxy_server] int main(): PRM service announced! [init -> proxy_server] int main(): PRAM service announced! [init -> proxy_server] int main(): --- starting test child --- [init -> proxy_server] virtual Proxy::Pram_session_component* Proxy::Pram_root::_create_session(const char*): Creating Pram_session_component...
KERNEL: Warning: nothing mapped: (Obj_space) from [0xfffffffffccfe5d8/38]: 0000000000000237 size: 0000000000000001 to [0xfffffffffccfe5d8/38]
Error: Test execution timed out make: *** [run/proxy] Fehler 254
I have no idea why this may happen. When running a component which is started by init and which is no child of my server component opening a
connection to my custom service works perfectly fine.
I'd be very grateful for a little bit of help here.
Best regards,
David
Hi David,
On 03/08/2016 10:15 PM, David Werner wrote:
Hi Genode-mailing-list,
i have a little problem with my ram and rm custom implementations.
When i try to create a child component which uses my custom sessions/services by running the following code:
int main(void) { PDBG("--- start proxy_server ---\n");
PDBG("--- announcing proxy services --- "); Cap_connection cap; static Sliced_heap sliced_heap(env()->ram_session(), env()->rm_session()); enum { STACK_SIZE = 8*1024 }; static Rpc_entrypoint ep(&cap, STACK_SIZE, "proxy_ep"); static Proxy::Prm_root prm_root(&ep, &ep, &sliced_heap); PDBG("PRM_root created and back in server-main!"); static Proxy::Pram_root pram_root(&ep, &ep, &sliced_heap); PDBG("PRAM_root created and back in server-main!");
env()->parent()->announce(ep.manage(&prm_root)); PDBG("PRM service announced!");
env()->parent()->announce(ep.manage(&pram_root)); PDBG("PRAM service announced!");
PDBG("--- starting test child ---"); /* Creating session for child environment */ static Rom_connection rom("proxy_test_client"); static Pd_connection pd; static Proxy::Pram_connection pram; <---------------- custom
service, execution fails here. static Cpu_connection cpu; static Proxy::Prm_connection prm; <---------------- custom service static Cap_connection child_cap;
/* declaring ref account for child's ram session and transferring
quota */
enum { CHILD_QUOTA = 1*1024*1024 }; pram.ref_account(env()->ram_session_cap());
env()->ram_session()->transfer_quota(pram.ram_cap(), CHILD_QUOTA);
/* creating test child */ Test_child proxy_test_child(rom.dataspace(), pd.cap(), pram.cap(),
cpu.cap(), prm.cap(), &child_cap);
PDBG("--- proxy_server is going to sleep ---"); sleep_forever(); PDBG("Server still awake - This output should not be reached!"); return 0;
}
I get this output:
Genode 15.11-71-g2e0e767 int main(): --- create local services --- int main(): --- start init --- int main(): transferred 112 MB to init int main(): --- init created, waiting for exit condition --- [init] Could not open ROM session for module "ld.lib.so" [init -> proxy_server] int main(): --- start proxy_server --- [init -> proxy_server] int main(): --- announcing proxy services --- [init -> proxy_server] Proxy::Prm_root::Prm_root(Genode::Rpc_entrypoint*, Genode::Rpc_entrypoint*, Genode::Allocator*): Creating Prm_root_component... [init -> proxy_server] int main(): PRM_root created and back in server-main! [init -> proxy_server] Proxy::Pram_root::Pram_root(Genode::Rpc_entrypoint*, Genode::Rpc_entrypoint*, Genode::Allocator*): Creating Pram_root_component... [init -> proxy_server] int main(): PRAM_root created and back in server-main! [init -> proxy_server] int main(): PRM service announced! [init -> proxy_server] int main(): PRAM service announced! [init -> proxy_server] int main(): --- starting test child --- [init -> proxy_server] virtual Proxy::Pram_session_component* Proxy::Pram_root::_create_session(const char*): Creating Pram_session_component...
KERNEL: Warning: nothing mapped: (Obj_space) from [0xfffffffffccfe5d8/38]: 0000000000000237 size: 0000000000000001 to [0xfffffffffccfe5d8/38]
Here the Fiasco.OC kernel claims that a capability should be mapped from one component to another, which failed because it was invalid. It seems it actually is a mapping within the same component (due to the same task addresses in square brackets).
Error: Test execution timed out make: *** [run/proxy] Fehler 254
I have no idea why this may happen. When running a component which is started by init and which is no child of my server component opening a
connection to my custom service works perfectly fine.
Are you sure that in the scenario, where the child is created directly by init, your service's PRAM and PRM interfaces are used at all? When you route the child's RM and RAM session requests to your component that does not mean they are used to create the child. For this purpose the routes of init itself are decisive. Only RM and RAM sessions opened by the child itself are routed according to the child's policy.
I'd be very grateful for a little bit of help here.
I would localize further where in the creation of Pram_session_component the kernel warning is shown. You can always enter the kernel debugger via 'enter_kdebug("some string");'. Also enabling IPC logging in the kernel debugger shortly before the kernel warning might help you. You can inspect the IPC log messages via the trace buffer again within the kernel debugger.
I'm afraid I cannot help you without more knowledge about your implementation details.
Regards Stefan
Best regards,
David
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://makebettercode.com/inteldaal-eval _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hi Stefan,
thank you for your answer!
Are you sure that in the scenario, where the child is created directly by init, your service's PRAM and PRM interfaces are used at all? When you route the child's RM and RAM session requests to your component that does not mean they are used to create the child. For this purpose the routes of init itself are decisive. Only RM and RAM sessions opened by the child itself are routed according to the child's policy.
i didn't express myself correctly with the part about starting another component as a child of init. Sorry for that.
What I meant is that when I start a component (created with core-services as environment) next to my server which executes a main method like this:
int main (void)
{ Proxy::Prm_connection prm; PDBG("Prm_connection established -> Prm_session created");
Proxy::Pram_connection pram; PDBG("Pram_connection established -> Pram_session created");
pram.ref_account(env()->ram_session_cap()); PDBG("Own ram_session is now ref_account of the pram_session");
env()->ram_session()->transfer_quota(pram.ram_cap(), 32*1024); PDBG("Quota transfered");
Ram_dataspace_capability ds = pram.alloc(4096); PDBG("Dataspace allocated");
void *addr = prm.attach(ds); PDBG("Dataspace attached to Prm_session");
prm.detach(addr); PDBG("Pram dataspace detached from Prm_session");
pram.free(ds); PDBG("Dataspace freed");
}
no problem occurs.
Here are some parts of my code. Could you take a look at it ? I will try your advice with the kernel debug.
Pram_session_component *_create_session(const char *args) from Pram_root { Genode::size_t ram_quota = Genode::Arg_string::find_arg(args, "ram_quota").ulong_value(0);
enum { MAX_LABEL_LEN = 64 }; char label[MAX_LABEL_LEN]; Genode::Arg_string::find_arg(args, "label").string(label, ~0UL, "");
unsigned long phys_start = Genode::Arg_string::find_arg(args, "size").ulong_value(~0UL); unsigned long phys_size = Genode::Arg_string::find_arg(args, "start").ulong_value(~0UL);
PDBG("Creating Pram_session_component..."); return new (md_alloc()) Pram_session_component(_ds_ep, ep(), md_alloc(), ram_quota, (char *)label, phys_start, phys_size); }
__________________________________________________________________________________________________________________
class Pram_session_component : public Genode::Rpc_object<Pram_session> { private:
using Ds_slab = Genode::Synced_allocator<Genode::Tslab<Pdataspace_component, 4096> >;
Genode::Rpc_entrypoint *_ds_ep; Genode::Rpc_entrypoint *_pram_session_ep;
Genode::Allocator_guard _md_alloc; Ds_slab _ds_alloc;
Genode::Ram_connection _ram;
const char* _label; unsigned long _phys_start; unsigned long _phys_size;
. . .
}
__________________________________________________________________________________________________________________
Pram_session_component::Pram_session_component(Genode::Rpc_entrypoint *ds_ep, Genode::Rpc_entrypoint *pram_session_ep, Genode::Allocator *md_alloc, Genode::size_t ram_quota, const char *label, unsigned long phys_start, unsigned long phys_size) : _ds_ep(ds_ep), _pram_session_ep(pram_session_ep), _md_alloc(md_alloc, ram_quota), _ds_alloc(&_md_alloc), _ram(label, phys_start, phys_size), _label(label), _phys_start(phys_start), _phys_size(phys_size) { }
Thank you in advance.
Regards,
David
Hi David,
On 03/11/2016 03:21 PM, David Werner wrote:
Hi Stefan,
thank you for your answer!
Are you sure that in the scenario, where the child is created directly by init, your service's PRAM and PRM interfaces are used at all? When you route the child's RM and RAM session requests to your component that does not mean they are used to create the child. For this purpose the routes of init itself are decisive. Only RM and RAM sessions opened by the child itself are routed according to the child's policy.
i didn't express myself correctly with the part about starting another component as a child of init. Sorry for that.
What I meant is that when I start a component (created with core-services as environment) next to my server which executes a main method like this:
int main (void)
{ Proxy::Prm_connection prm; PDBG("Prm_connection established -> Prm_session created");
Proxy::Pram_connection pram; PDBG("Pram_connection established -> Pram_session created");
pram.ref_account(env()->ram_session_cap()); PDBG("Own ram_session is now ref_account of the pram_session");
env()->ram_session()->transfer_quota(pram.ram_cap(), 32*1024); PDBG("Quota transfered");
Ram_dataspace_capability ds = pram.alloc(4096); PDBG("Dataspace allocated"); void *addr = prm.attach(ds); PDBG("Dataspace attached to Prm_session"); prm.detach(addr); PDBG("Pram dataspace detached from Prm_session"); pram.free(ds); PDBG("Dataspace freed");
}
no problem occurs.
I see.
Here are some parts of my code. Could you take a look at it ? I will try your advice with the kernel debug.
Pram_session_component *_create_session(const char *args) from Pram_root { Genode::size_t ram_quota = Genode::Arg_string::find_arg(args, "ram_quota").ulong_value(0);
enum { MAX_LABEL_LEN = 64 }; char label[MAX_LABEL_LEN]; Genode::Arg_string::find_arg(args,
"label").string(label, ~0UL, "");
unsigned long phys_start =
Genode::Arg_string::find_arg(args, "size").ulong_value(~0UL); unsigned long phys_size = Genode::Arg_string::find_arg(args, "start").ulong_value(~0UL);
PDBG("Creating Pram_session_component..."); return new (md_alloc()) Pram_session_component(_ds_ep,
ep(), md_alloc(), ram_quota, (char *)label, phys_start, phys_size); }
class Pram_session_component : public Genode::Rpc_object<Pram_session> { private:
using Ds_slab =
Genode::Synced_allocator<Genode::Tslab<Pdataspace_component, 4096> >;
Genode::Rpc_entrypoint *_ds_ep; Genode::Rpc_entrypoint *_pram_session_ep; Genode::Allocator_guard _md_alloc; Ds_slab _ds_alloc; Genode::Ram_connection _ram; const char* _label; unsigned long _phys_start; unsigned long _phys_size; . . . }
Pram_session_component::Pram_session_component(Genode::Rpc_entrypoint *ds_ep, Genode::Rpc_entrypoint *pram_session_ep, Genode::Allocator *md_alloc, Genode::size_t ram_quota, const char *label, unsigned long phys_start, unsigned long phys_size) : _ds_ep(ds_ep), _pram_session_ep(pram_session_ep), _md_alloc(md_alloc, ram_quota), _ds_alloc(&_md_alloc), _ram(label, phys_start, phys_size), _label(label), _phys_start(phys_start), _phys_size(phys_size) { }
I cannot see any obvious reasons for the faulty execution you describe. Although, I would implement some things in a different manner, like extending RM and RAM instead of defining PRM and PRAM, and invoking the root component directly instead of calling the parent therefore. Anyway, theoretically it should work the way you have designed it.
The obvious difference in both examples is: in the working case you refer to a remotely implemented service, whereas in the broken example the service actually is a locally implemented one. Nevertheless, in both cases you use the parent (init) as intermediate component. For further assistance, as far as you do not succeed with the kernel debugger on your own, you might provide the complete example in form of a branch (or patch to a known Genode revision) including a working run-script that triggers the fault.
Regards Stefan
Thank you in advance.
Regards,
David
Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main