Custom implementation of core services

Stefan Kalkowski stefan.kalkowski at ...1...
Mon Mar 14 11:54:59 CET 2016


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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
> 

-- 
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ ยท http://genode.org/




More information about the users mailing list