mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Remove blocking calls from root and parent RPCs
This is a redesign of the root and parent interfaces to eliminate blocking RPC calls. - New session representation at the parent (base/session_state.h) - base-internal root proxy mechanism as migration path - Redesign of base/service.h - Removes ancient 'Connection::KEEP_OPEN' feature - Interface change of 'Child', 'Child_policy', 'Slave', 'Slave_policy' - New 'Slave::Connection' - Changed child-construction procedure to be compatible with the non-blocking parent interface and to be easier to use - The child's initial LOG session, its binary ROM session, and the linker ROM session have become part of the child's envirenment. - Session upgrading must now be performed via 'env.upgrade' instead of performing a sole RPC call the parent. To make RAM upgrades easier, the 'Connection' provides a new 'upgrade_ram' method. Issue #2120
This commit is contained in:
committed by
Christian Helmuth
parent
3cc2a3f085
commit
cfdbccc5c2
@@ -24,6 +24,7 @@
|
||||
#include <core_pd_session.h>
|
||||
#include <ram_session_component.h>
|
||||
#include <core_pd_session.h>
|
||||
#include <base/service.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/platform_env.h>
|
||||
@@ -138,8 +139,6 @@ namespace Genode {
|
||||
|
||||
typedef Synchronized_ram_session<Ram_session_component> Core_ram_session;
|
||||
|
||||
Core_parent _core_parent;
|
||||
|
||||
/*
|
||||
* Initialize the stack area before creating the first thread,
|
||||
* which happens to be the '_entrypoint'.
|
||||
@@ -163,6 +162,10 @@ namespace Genode {
|
||||
Heap _heap;
|
||||
Ram_session_capability const _ram_session_cap;
|
||||
|
||||
Registry<Service> _services;
|
||||
|
||||
Core_parent _core_parent { _heap, _services };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@@ -210,6 +213,8 @@ namespace Genode {
|
||||
warning(__FILE__, ":", __LINE__, " not implemented");
|
||||
return Cpu_session_capability();
|
||||
}
|
||||
|
||||
Registry<Service> &services() { return _services; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/expanding_parent_client.h>
|
||||
|
||||
namespace Genode { class Local_parent; }
|
||||
namespace Genode {
|
||||
|
||||
class Local_session;
|
||||
class Local_parent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -42,6 +46,7 @@ class Genode::Local_parent : public Expanding_parent_client
|
||||
private:
|
||||
|
||||
Allocator &_alloc;
|
||||
Id_space<Client> _local_sessions_id_space;
|
||||
|
||||
public:
|
||||
|
||||
@@ -49,10 +54,9 @@ class Genode::Local_parent : public Expanding_parent_client
|
||||
** Parent interface **
|
||||
**********************/
|
||||
|
||||
Session_capability session(Service_name const &,
|
||||
Session_args const &,
|
||||
Affinity const & = Affinity());
|
||||
void close(Session_capability);
|
||||
Session_capability session(Client::Id, Service_name const &, Session_args const &,
|
||||
Affinity const & = Affinity()) override;
|
||||
Close_result close(Client::Id) override;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@@ -19,17 +19,22 @@
|
||||
#include <base/allocator.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/local_session.h>
|
||||
#include <base/internal/region_map_mmap.h>
|
||||
#include <base/internal/local_capability.h>
|
||||
|
||||
namespace Genode { struct Local_rm_session; }
|
||||
|
||||
|
||||
struct Genode::Local_rm_session : Rm_session
|
||||
struct Genode::Local_rm_session : Rm_session, Local_session
|
||||
{
|
||||
Allocator &md_alloc;
|
||||
|
||||
Local_rm_session(Allocator &md_alloc) : md_alloc(md_alloc) { }
|
||||
Local_rm_session(Allocator &md_alloc, Id_space<Parent::Client> &id_space,
|
||||
Parent::Client::Id id)
|
||||
:
|
||||
Local_session(id_space, id, *this), md_alloc(md_alloc)
|
||||
{ }
|
||||
|
||||
Capability<Region_map> create(size_t size)
|
||||
{
|
||||
|
||||
44
repos/base-linux/src/include/base/internal/local_session.h
Normal file
44
repos/base-linux/src/include/base/internal/local_session.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* \brief Meta data for component-local sessions
|
||||
* \author Norman Feske
|
||||
* \date 2016-10-13
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__BASE__INTERNAL__LOCAL_SESSION_H_
|
||||
#define _INCLUDE__BASE__INTERNAL__LOCAL_SESSION_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/id_space.h>
|
||||
|
||||
namespace Genode { struct Local_session; }
|
||||
|
||||
|
||||
struct Genode::Local_session : Parent::Client
|
||||
{
|
||||
private:
|
||||
|
||||
Id_space<Parent::Client>::Element _id_space_element;
|
||||
|
||||
Session_capability _cap;
|
||||
|
||||
public:
|
||||
|
||||
Local_session(Id_space<Parent::Client> &id_space, Parent::Client::Id id,
|
||||
Session &session)
|
||||
:
|
||||
_id_space_element(*this, id_space, id),
|
||||
_cap(Local_capability<Session>::local_cap(&session))
|
||||
{ }
|
||||
|
||||
Capability<Session> local_session_cap() { return _cap; }
|
||||
};
|
||||
|
||||
|
||||
#endif /* _INCLUDE__BASE__INTERNAL__LOCAL_SESSION_H_ */
|
||||
@@ -69,9 +69,9 @@ class Genode::Platform_env_base : public Env_deprecated
|
||||
Pd_session_capability pd_cap)
|
||||
:
|
||||
_ram_session_cap(ram_cap),
|
||||
_ram_session_client(_ram_session_cap),
|
||||
_ram_session_client(_ram_session_cap, Parent::Env::ram()),
|
||||
_cpu_session_cap(cpu_cap),
|
||||
_cpu_session_client(cpu_cap),
|
||||
_cpu_session_client(cpu_cap, Parent::Env::cpu()),
|
||||
_region_map_mmap(false),
|
||||
_pd_session_cap(pd_cap),
|
||||
_local_pd_session(_pd_session_cap)
|
||||
|
||||
@@ -59,37 +59,44 @@ bool Region_map_mmap::_dataspace_writable(Dataspace_capability ds)
|
||||
** Local_parent **
|
||||
******************/
|
||||
|
||||
Session_capability Local_parent::session(Service_name const &service_name,
|
||||
Session_capability Local_parent::session(Parent::Client::Id id,
|
||||
Service_name const &service_name,
|
||||
Session_args const &args,
|
||||
Affinity const &affinity)
|
||||
{
|
||||
if (strcmp(service_name.string(), Rm_session::service_name()) == 0)
|
||||
{
|
||||
Local_rm_session *session = new (_alloc) Local_rm_session(_alloc);
|
||||
if (strcmp(service_name.string(), Rm_session::service_name()) == 0) {
|
||||
|
||||
return Local_capability<Session>::local_cap(session);
|
||||
Local_rm_session *local_rm_session = new (_alloc)
|
||||
Local_rm_session(_alloc, _local_sessions_id_space, id);
|
||||
|
||||
return local_rm_session->local_session_cap();
|
||||
}
|
||||
|
||||
return Expanding_parent_client::session(service_name, args, affinity);
|
||||
return Expanding_parent_client::session(id, service_name, args, affinity);
|
||||
}
|
||||
|
||||
|
||||
void Local_parent::close(Session_capability session)
|
||||
Parent::Close_result Local_parent::close(Client::Id id)
|
||||
{
|
||||
auto close_local_fn = [&] (Local_session &local_session)
|
||||
{
|
||||
Capability<Rm_session> rm =
|
||||
static_cap_cast<Rm_session>(local_session.local_session_cap());
|
||||
destroy(_alloc, Local_capability<Rm_session>::deref(rm));
|
||||
};
|
||||
|
||||
/*
|
||||
* Handle non-local capabilities
|
||||
* Local RM sessions are present in the '_local_sessions_id_space'. If the
|
||||
* apply succeeds, 'id' referred to the local session. Otherwise, we
|
||||
* forward the request to the parent.
|
||||
*/
|
||||
if (session.valid()) {
|
||||
Parent_client::close(session);
|
||||
return;
|
||||
try {
|
||||
_local_sessions_id_space.apply<Local_session>(id, close_local_fn);
|
||||
return CLOSE_DONE;
|
||||
}
|
||||
catch (Id_space<Client>::Unknown_id) { }
|
||||
|
||||
/*
|
||||
* Detect capability to local RM session
|
||||
*/
|
||||
Capability<Rm_session> rm = static_cap_cast<Rm_session>(session);
|
||||
|
||||
destroy(_alloc, Local_capability<Rm_session>::deref(rm));
|
||||
return Parent_client::close(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,9 +155,9 @@ Local_parent &Platform_env::_parent()
|
||||
|
||||
Platform_env::Platform_env()
|
||||
:
|
||||
Platform_env_base(static_cap_cast<Ram_session>(_parent().session("Env::ram_session", "")),
|
||||
static_cap_cast<Cpu_session>(_parent().session("Env::cpu_session", "")),
|
||||
static_cap_cast<Pd_session> (_parent().session("Env::pd_session", ""))),
|
||||
Platform_env_base(static_cap_cast<Ram_session>(_parent().session_cap(Parent::Env::ram())),
|
||||
static_cap_cast<Cpu_session>(_parent().session_cap(Parent::Env::cpu())),
|
||||
static_cap_cast<Pd_session> (_parent().session_cap(Parent::Env::pd()))),
|
||||
_heap(Platform_env_base::ram_session(), Platform_env_base::rm_session()),
|
||||
_emergency_ram_ds(ram_session()->alloc(_emergency_ram_size()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user