mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
base-hw: handle cap-slab exhaust in Thread::start
This interim solution for issue #5256 solves the problem for the thread.run script. Issue #5256
This commit is contained in:
parent
d9d2a7584e
commit
5a6c4d6ff2
@ -27,6 +27,9 @@ struct Genode::Hw_native_pd_client : Rpc_client<Pd_session::Native_pd>
|
|||||||
|
|
||||||
void upgrade_cap_slab() override {
|
void upgrade_cap_slab() override {
|
||||||
call<Rpc_upgrade_cap_slab>(); }
|
call<Rpc_upgrade_cap_slab>(); }
|
||||||
|
|
||||||
|
size_t avail_cap_slab() override {
|
||||||
|
return call<Rpc_avail_cap_slab>(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__HW_NATIVE_PD__CLIENT_H_ */
|
#endif /* _INCLUDE__HW_NATIVE_PD__CLIENT_H_ */
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
struct Genode::Pd_session::Native_pd : Interface
|
struct Genode::Pd_session::Native_pd : Interface
|
||||||
{
|
{
|
||||||
virtual void upgrade_cap_slab() = 0;
|
virtual void upgrade_cap_slab() = 0;
|
||||||
|
virtual size_t avail_cap_slab() = 0;
|
||||||
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@ -29,7 +30,8 @@ struct Genode::Pd_session::Native_pd : Interface
|
|||||||
|
|
||||||
GENODE_RPC_THROW(Rpc_upgrade_cap_slab, void, upgrade_cap_slab,
|
GENODE_RPC_THROW(Rpc_upgrade_cap_slab, void, upgrade_cap_slab,
|
||||||
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps));
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps));
|
||||||
GENODE_RPC_INTERFACE(Rpc_upgrade_cap_slab);
|
GENODE_RPC(Rpc_avail_cap_slab, size_t, avail_cap_slab);
|
||||||
|
GENODE_RPC_INTERFACE(Rpc_upgrade_cap_slab, Rpc_avail_cap_slab);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__HW_NATIVE_PD__HW_NATIVE_PD_H_ */
|
#endif /* _INCLUDE__HW_NATIVE_PD__HW_NATIVE_PD_H_ */
|
||||||
|
@ -23,6 +23,12 @@ void Native_pd_component::upgrade_cap_slab()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t Native_pd_component::avail_cap_slab()
|
||||||
|
{
|
||||||
|
return _pd_session._pd->avail_slab();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Native_pd_component::Native_pd_component(Pd_session_component &pd, char const *)
|
Native_pd_component::Native_pd_component(Pd_session_component &pd, char const *)
|
||||||
:
|
:
|
||||||
_pd_session(pd)
|
_pd_session(pd)
|
||||||
|
@ -41,6 +41,7 @@ class Core::Native_pd_component : public Rpc_object<Pd_session::Native_pd>
|
|||||||
~Native_pd_component();
|
~Native_pd_component();
|
||||||
|
|
||||||
void upgrade_cap_slab() override;
|
void upgrade_cap_slab() override;
|
||||||
|
size_t avail_cap_slab() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__NATIVE_PD_COMPONENT_H_ */
|
#endif /* _CORE__INCLUDE__NATIVE_PD_COMPONENT_H_ */
|
||||||
|
@ -163,6 +163,7 @@ class Core::Cap_space
|
|||||||
Cap_slab & capability_slab() { return _slab; }
|
Cap_slab & capability_slab() { return _slab; }
|
||||||
|
|
||||||
void upgrade_slab(Allocator &alloc);
|
void upgrade_slab(Allocator &alloc);
|
||||||
|
size_t avail_slab() { return _slab.avail_entries(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -208,6 +209,7 @@ class Core::Platform_pd : public Hw::Address_space, private Cap_space
|
|||||||
|
|
||||||
using Cap_space::capability_slab;
|
using Cap_space::capability_slab;
|
||||||
using Cap_space::upgrade_slab;
|
using Cap_space::upgrade_slab;
|
||||||
|
using Cap_space::avail_slab;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind thread to protection domain
|
* Bind thread to protection domain
|
||||||
|
@ -14,12 +14,16 @@
|
|||||||
#ifndef _INCLUDE__BASE__INTERNAL__NATIVE_ENV_H_
|
#ifndef _INCLUDE__BASE__INTERNAL__NATIVE_ENV_H_
|
||||||
#define _INCLUDE__BASE__INTERNAL__NATIVE_ENV_H_
|
#define _INCLUDE__BASE__INTERNAL__NATIVE_ENV_H_
|
||||||
|
|
||||||
|
#include <base/stdint.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade quota of the PD session's capability slab allocator
|
* Upgrade quota of the PD session's capability slab allocator
|
||||||
*/
|
*/
|
||||||
void upgrade_capability_slab();
|
void upgrade_capability_slab();
|
||||||
|
|
||||||
|
size_t avail_capability_slab();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__BASE__INTERNAL__NATIVE_ENV_H_ */
|
#endif /* _INCLUDE__BASE__INTERNAL__NATIVE_ENV_H_ */
|
||||||
|
@ -32,6 +32,12 @@ void Genode::init_cap_slab(Pd_session &pd, Parent &parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t Genode::avail_capability_slab()
|
||||||
|
{
|
||||||
|
return native_pd_ptr ? native_pd_ptr->avail_cap_slab() : 0UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Genode::upgrade_capability_slab()
|
void Genode::upgrade_capability_slab()
|
||||||
{
|
{
|
||||||
if (!native_pd_ptr || !parent_ptr) {
|
if (!native_pd_ptr || !parent_ptr) {
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
/* base-internal includes */
|
/* base-internal includes */
|
||||||
#include <base/internal/stack_allocator.h>
|
#include <base/internal/stack_allocator.h>
|
||||||
#include <base/internal/native_utcb.h>
|
#include <base/internal/native_utcb.h>
|
||||||
|
#include <base/internal/native_env.h>
|
||||||
#include <base/internal/globals.h>
|
#include <base/internal/globals.h>
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
@ -106,6 +107,9 @@ void Thread::_deinit_platform_thread()
|
|||||||
|
|
||||||
Thread::Start_result Thread::start()
|
Thread::Start_result Thread::start()
|
||||||
{
|
{
|
||||||
|
while (avail_capability_slab() < 5)
|
||||||
|
upgrade_capability_slab();
|
||||||
|
|
||||||
return _thread_cap.convert<Start_result>(
|
return _thread_cap.convert<Start_result>(
|
||||||
[&] (Thread_capability cap) {
|
[&] (Thread_capability cap) {
|
||||||
Cpu_thread_client cpu_thread(cap);
|
Cpu_thread_client cpu_thread(cap);
|
||||||
|
Loading…
Reference in New Issue
Block a user