mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 23:53:55 +00:00
Consolidate RM service into PD session
This patch integrates three region maps into each PD session to reduce the session overhead and to simplify the PD creation procedure. Please refer to the issue cited below for an elaborative discussion. Note the API change: With this patch, the semantics of core's RM service have changed. Now, the service is merely a tool for creating and destroying managed dataspaces, which are rarely needed. Regular components no longer need a RM session. For this reason, the corresponding argument for the 'Process' and 'Child' constructors has been removed. The former interface of the 'Rm_session' is not named 'Region_map'. As a minor refinement, the 'Fault_type' enum values are now part of the 'Region_map::State' struct. Issue #1938
This commit is contained in:
committed by
Christian Helmuth
parent
e20bbe7002
commit
511acad507
@ -131,7 +131,7 @@ namespace Iso {
|
||||
{
|
||||
size_t ram_quota =
|
||||
Arg_string::find_arg(args, "ram_quota").ulong_value(0);
|
||||
size_t session_size = sizeof(Rom_component) + sizeof(File_info) + sizeof(Rm_connection);
|
||||
size_t session_size = sizeof(Rom_component) + sizeof(File_info);
|
||||
if (ram_quota < session_size)
|
||||
throw Root::Quota_exceeded();
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include <util/arg_string.h>
|
||||
#include <init/child_policy.h>
|
||||
#include <ram_session/connection.h>
|
||||
#include <rm_session/connection.h>
|
||||
#include <cpu_session/connection.h>
|
||||
#include <pd_session/connection.h>
|
||||
#include <region_map/client.h>
|
||||
|
||||
|
||||
namespace Loader {
|
||||
@ -45,7 +45,6 @@ namespace Loader {
|
||||
Pd_connection pd;
|
||||
Ram_connection ram;
|
||||
Cpu_connection cpu;
|
||||
Rm_connection rm;
|
||||
|
||||
Resources(char const *label,
|
||||
Ram_session_client &ram_session_client,
|
||||
@ -54,8 +53,7 @@ namespace Loader {
|
||||
: pd(label), ram(label), cpu(label)
|
||||
{
|
||||
/* deduce session costs from usable ram quota */
|
||||
size_t session_donations = Rm_connection::RAM_QUOTA +
|
||||
Cpu_connection::RAM_QUOTA +
|
||||
size_t session_donations = Cpu_connection::RAM_QUOTA +
|
||||
Ram_connection::RAM_QUOTA;
|
||||
|
||||
if (ram_quota > session_donations)
|
||||
@ -70,7 +68,8 @@ namespace Loader {
|
||||
* the loader client via 'Loader_session::fault_handler'.
|
||||
*/
|
||||
cpu.exception_handler(Thread_capability(), fault_sigh);
|
||||
rm.fault_handler(fault_sigh);
|
||||
Region_map_client address_space(pd.address_space());
|
||||
address_space.fault_handler(fault_sigh);
|
||||
}
|
||||
} _resources;
|
||||
|
||||
@ -79,7 +78,7 @@ namespace Loader {
|
||||
Service &_local_nitpicker_service;
|
||||
Service &_local_rom_service;
|
||||
Service &_local_cpu_service;
|
||||
Service &_local_rm_service;
|
||||
Service &_local_pd_service;
|
||||
|
||||
Rom_session_client _binary_rom_session;
|
||||
|
||||
@ -110,7 +109,7 @@ namespace Loader {
|
||||
Service_registry &parent_services,
|
||||
Service &local_rom_service,
|
||||
Service &local_cpu_service,
|
||||
Service &local_rm_service,
|
||||
Service &local_pd_service,
|
||||
Service &local_nitpicker_service,
|
||||
Signal_context_capability fault_sigh)
|
||||
:
|
||||
@ -121,13 +120,12 @@ namespace Loader {
|
||||
_local_nitpicker_service(local_nitpicker_service),
|
||||
_local_rom_service(local_rom_service),
|
||||
_local_cpu_service(local_cpu_service),
|
||||
_local_rm_service(local_rm_service),
|
||||
_local_pd_service(local_pd_service),
|
||||
_binary_rom_session(_rom_session(binary_name)),
|
||||
_binary_policy("binary", _binary_rom_session.dataspace(), &_ep),
|
||||
_labeling_policy(_label.string),
|
||||
_child(_binary_rom_session.dataspace(), _resources.pd.cap(),
|
||||
_resources.ram.cap(), _resources.cpu.cap(),
|
||||
_resources.rm.cap(), &_ep, this)
|
||||
_resources.ram.cap(), _resources.cpu.cap(), &_ep, this)
|
||||
{ }
|
||||
|
||||
~Child()
|
||||
@ -158,7 +156,7 @@ namespace Loader {
|
||||
if (!strcmp(name, "Nitpicker")) return &_local_nitpicker_service;
|
||||
if (!strcmp(name, "ROM")) return &_local_rom_service;
|
||||
if (!strcmp(name, "CPU")) return &_local_cpu_service;
|
||||
if (!strcmp(name, "RM")) return &_local_rm_service;
|
||||
if (!strcmp(name, "PD")) return &_local_pd_service;
|
||||
|
||||
/* populate session-local parent service registry on demand */
|
||||
service = _parent_services.find(name);
|
||||
|
@ -128,7 +128,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
||||
};
|
||||
|
||||
/**
|
||||
* Common base class of 'Local_cpu_service' and 'Local_rm_service'
|
||||
* Common base class of 'Local_cpu_service' and 'Local_pd_service'
|
||||
*/
|
||||
struct Intercepted_parent_service : Service
|
||||
{
|
||||
@ -168,18 +168,22 @@ class Loader::Session_component : public Rpc_object<Session>
|
||||
};
|
||||
|
||||
/**
|
||||
* Intercept RM session requests to install default fault handler
|
||||
* Intercept PD session requests to install default fault handler
|
||||
*/
|
||||
struct Local_rm_service : Intercepted_parent_service
|
||||
struct Local_pd_service : Intercepted_parent_service
|
||||
{
|
||||
Local_rm_service() : Intercepted_parent_service("RM") { }
|
||||
Local_pd_service() : Intercepted_parent_service("PD") { }
|
||||
|
||||
Genode::Session_capability session(char const *args,
|
||||
Affinity const &affinity)
|
||||
{
|
||||
Capability<Rm_session> cap = env()->parent()->session<Rm_session>(args, affinity);
|
||||
Rm_session_client(cap).fault_handler(fault_sigh);
|
||||
return cap;
|
||||
Pd_session_client pd(env()->parent()->session<Pd_session>(args, affinity));
|
||||
|
||||
Region_map_client(pd.address_space()).fault_handler(fault_sigh);
|
||||
Region_map_client(pd.stack_area()) .fault_handler(fault_sigh);
|
||||
Region_map_client(pd.linker_area()) .fault_handler(fault_sigh);
|
||||
|
||||
return pd;
|
||||
}
|
||||
};
|
||||
|
||||
@ -256,7 +260,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
||||
Rom_module_registry _rom_modules;
|
||||
Local_rom_service _rom_service;
|
||||
Local_cpu_service _cpu_service;
|
||||
Local_rm_service _rm_service;
|
||||
Local_pd_service _pd_service;
|
||||
Local_nitpicker_service _nitpicker_service;
|
||||
Signal_context_capability _fault_sigh;
|
||||
Child *_child;
|
||||
@ -352,10 +356,10 @@ class Loader::Session_component : public Rpc_object<Session>
|
||||
_cpu_service.fault_sigh = sigh;
|
||||
|
||||
/*
|
||||
* RM fault handler for RM sessions originating from the
|
||||
* Region-map fault handler for PD sessions originating from the
|
||||
* subsystem.
|
||||
*/
|
||||
_rm_service.fault_sigh = sigh;
|
||||
_pd_service.fault_sigh = sigh;
|
||||
|
||||
/*
|
||||
* CPU exception and RM fault handler for the immediate child.
|
||||
@ -379,7 +383,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
||||
Child(binary_name.string(), label.string(),
|
||||
_ep, _ram_session_client,
|
||||
ram_quota, _parent_services, _rom_service,
|
||||
_cpu_service, _rm_service, _nitpicker_service,
|
||||
_cpu_service, _pd_service, _nitpicker_service,
|
||||
_fault_sigh);
|
||||
}
|
||||
catch (Genode::Parent::Service_denied) {
|
||||
|
Reference in New Issue
Block a user