Remove Rpc_entrypoint::Native_context

This patch largely reverts the commit "base: lay groundwork for
base-linux caps change" because the use of 'epoll' instead of 'select'
alleviated the need to allocate large FD sets, which motivated the
introduction of the 'Native_context' hook.

Related to issue #3581
This commit is contained in:
Norman Feske
2020-04-21 16:41:13 +02:00
parent 01bf32b998
commit b134867f31
20 changed files with 78 additions and 197 deletions

View File

@@ -1,13 +1,11 @@
/*
* \brief Server-side API of the RPC framework
* \author Norman Feske
* \author Stefan Thöni
* \date 2006-04-28
*/
/*
* Copyright (C) 2006-2020 Genode Labs GmbH
* Copyright (C) 2020 gapfruit AG
* Copyright (C) 2006-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
@@ -280,6 +278,7 @@ struct Genode::Rpc_object : Rpc_object_base, Rpc_dispatcher<RPC_INTERFACE, SERVE
}
};
/**
* RPC entrypoint serving RPC objects
*
@@ -302,10 +301,6 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
*/
friend class Signal_receiver;
public:
class Native_context;
private:
/**
@@ -325,8 +320,6 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
*/
static void _activation_entry();
static size_t _native_stack_size(size_t stack_size);
struct Exit : Genode::Interface
{
GENODE_RPC(Rpc_exit, void, _exit);
@@ -351,7 +344,6 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
Pd_session &_pd_session; /* for creating capabilities */
Exit_handler _exit_handler { };
Capability<Exit> _exit_cap { };
Native_context *_native_context { nullptr };
/**
* Access to kernel-specific part of the PD session interface
@@ -407,12 +399,6 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
*/
void entry() override;
/**
* Called by implementation specific entry function
* with created native context
*/
void _entry(Native_context& native_context);
public:
/**
@@ -429,12 +415,8 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
char const *name, bool start_on_construction = true,
Affinity::Location location = Affinity::Location());
Rpc_entrypoint(Genode::Rpc_entrypoint const &) = delete;
~Rpc_entrypoint();
Genode::Rpc_entrypoint operator=(Genode::Rpc_entrypoint const &) = delete;
/**
* Associate RPC object with the entry point
*/

View File

@@ -17,7 +17,6 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/ipc.h>
#include <base/rpc_server.h>
namespace Genode {
@@ -45,25 +44,17 @@ namespace Genode {
/**
* Send result of previous RPC request and wait for new one
*/
Rpc_request ipc_reply_wait(Reply_capability const &caller,
Rpc_exception_code reply_exc,
Msgbuf_base &reply_msg,
Msgbuf_base &request_msg,
Rpc_entrypoint::Native_context &native_context);
Rpc_request ipc_reply_wait(Reply_capability const &caller,
Rpc_exception_code reply_exc,
Msgbuf_base &reply_msg,
Msgbuf_base &request_msg);
}
class Genode::Ipc_server : public Native_capability
struct Genode::Ipc_server : Native_capability
{
private:
Rpc_entrypoint::Native_context& _native_context;
public:
Ipc_server(Rpc_entrypoint::Native_context& native_context);
~Ipc_server();
Ipc_server();
~Ipc_server();
};
#endif /* _INCLUDE__BASE__INTERNAL__IPC_SERVER_H_ */

View File

@@ -20,11 +20,33 @@
using namespace Genode;
void Rpc_entrypoint::_entry(Native_context& native_context)
{
_native_context = &native_context;
Ipc_server srv(native_context);
/***********************
** Server entrypoint **
***********************/
Untyped_capability Rpc_entrypoint::_manage(Rpc_object_base *obj)
{
/* don't manage RPC object twice */
if (obj->cap().valid()) {
warning("attempt to manage RPC object twice");
return obj->cap();
}
Untyped_capability new_obj_cap = _alloc_rpc_cap(_pd_session, _cap);
/* add server object to object pool */
obj->cap(new_obj_cap);
insert(obj);
/* return capability that uses the object id as badge */
return new_obj_cap;
}
void Rpc_entrypoint::entry()
{
Ipc_server srv;
_cap = srv;
_cap_valid.wakeup();
@@ -41,7 +63,7 @@ void Rpc_entrypoint::_entry(Native_context& native_context)
while (!_exit_handler.exit) {
Rpc_request const request = ipc_reply_wait(_caller, exc, _snd_buf, _rcv_buf, native_context);
Rpc_request const request = ipc_reply_wait(_caller, exc, _snd_buf, _rcv_buf);
_caller = request.caller;
Ipc_unmarshaller unmarshaller(_rcv_buf);

View File

@@ -1,40 +0,0 @@
/*
* \brief Default version of platform-specific part of RPC framework
* \author Stefan Thöni
* \date 2020-01-30
*/
/*
* Copyright (C) 2006-2020 Genode Labs GmbH
* Copyright (C) 2020 gapfruit AG
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <base/rpc_server.h>
/* base-internal includes */
#include <base/internal/ipc_server.h>
using namespace Genode;
class Rpc_entrypoint::Native_context
{
};
void Rpc_entrypoint::entry()
{
Native_context context { };
_entry(context);
}
size_t Rpc_entrypoint::_native_stack_size(size_t stack_size)
{
return stack_size + sizeof(Native_context);
}

View File

@@ -73,7 +73,7 @@ Rpc_entrypoint::Rpc_entrypoint(Pd_session *pd_session, size_t stack_size,
char const *name, bool start_on_construction,
Affinity::Location location)
:
Thread(Cpu_session::Weight::DEFAULT_WEIGHT, name, _native_stack_size(stack_size), location),
Thread(Cpu_session::Weight::DEFAULT_WEIGHT, name, stack_size, location),
_cap(Untyped_capability()),
_pd_session(*pd_session)
{

View File

@@ -1,45 +0,0 @@
/*
* \brief Default version of platform-specific part of RPC framework
* \author Norman Feske
* \date 2006-05-12
*/
/*
* Copyright (C) 2006-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <util/retry.h>
#include <base/rpc_server.h>
/* base-internal includes */
#include <base/internal/ipc_server.h>
using namespace Genode;
/***********************
** Server entrypoint **
***********************/
Untyped_capability Rpc_entrypoint::_manage(Rpc_object_base *obj)
{
/* don't manage RPC object twice */
if (obj->cap().valid()) {
warning("attempt to manage RPC object twice");
return obj->cap();
}
Untyped_capability new_obj_cap = _alloc_rpc_cap(_pd_session, _cap);
/* add server object to object pool */
obj->cap(new_obj_cap);
insert(obj);
/* return capability that uses the object id as badge */
return new_obj_cap;
}