parent
8c3d044928
commit
42cef716e1
|
@ -122,6 +122,11 @@ namespace Genode {
|
||||||
*/
|
*/
|
||||||
~Cpu_session_component();
|
~Cpu_session_component();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register quota donation at allocator guard
|
||||||
|
*/
|
||||||
|
void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); }
|
||||||
|
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
** CPU session interface **
|
** CPU session interface **
|
||||||
|
|
|
@ -117,6 +117,11 @@ namespace Genode {
|
||||||
*/
|
*/
|
||||||
~Cpu_session_component();
|
~Cpu_session_component();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register quota donation at allocator guard
|
||||||
|
*/
|
||||||
|
void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); }
|
||||||
|
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
** CPU session interface **
|
** CPU session interface **
|
||||||
|
|
|
@ -122,6 +122,11 @@ namespace Genode {
|
||||||
*/
|
*/
|
||||||
~Cpu_session_component();
|
~Cpu_session_component();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register quota donation at allocator guard
|
||||||
|
*/
|
||||||
|
void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); }
|
||||||
|
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
** CPU session interface **
|
** CPU session interface **
|
||||||
|
|
|
@ -125,6 +125,36 @@ namespace Genode {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Expanding_cpu_session_client : public Cpu_session_client
|
||||||
|
{
|
||||||
|
Cpu_session_capability _cap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Expanding_cpu_session_client(Cpu_session_capability cap)
|
||||||
|
: Cpu_session_client(cap), _cap(cap) { }
|
||||||
|
|
||||||
|
Thread_capability create_thread(Name const &name, addr_t utcb) {
|
||||||
|
bool try_again = false;
|
||||||
|
do {
|
||||||
|
try {
|
||||||
|
return Cpu_session_client::create_thread(name, utcb);
|
||||||
|
} catch (Cpu_session::Out_of_metadata) {
|
||||||
|
|
||||||
|
/* give up if the error occurred a second time */
|
||||||
|
if (try_again)
|
||||||
|
break;
|
||||||
|
|
||||||
|
PINF("upgrade quota donation for Env::CPU session");
|
||||||
|
env()->parent()->upgrade(_cap, "ram_quota=8K");
|
||||||
|
try_again = true;
|
||||||
|
}
|
||||||
|
} while (try_again);
|
||||||
|
|
||||||
|
return Thread_capability();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Parent_client _parent_client;
|
Parent_client _parent_client;
|
||||||
|
@ -134,7 +164,7 @@ namespace Genode {
|
||||||
Ram_session_capability ram_cap;
|
Ram_session_capability ram_cap;
|
||||||
Expanding_ram_session_client ram;
|
Expanding_ram_session_client ram;
|
||||||
Cpu_session_capability cpu_cap;
|
Cpu_session_capability cpu_cap;
|
||||||
Cpu_session_client cpu;
|
Expanding_cpu_session_client cpu;
|
||||||
Expanding_rm_session_client rm;
|
Expanding_rm_session_client rm;
|
||||||
Pd_session_client pd;
|
Pd_session_client pd;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace Genode {
|
||||||
|
|
||||||
class Thread_creation_failed : public Exception { };
|
class Thread_creation_failed : public Exception { };
|
||||||
class State_access_failed : public Exception { };
|
class State_access_failed : public Exception { };
|
||||||
|
class Out_of_metadata : public Exception { };
|
||||||
|
|
||||||
static const char *service_name() { return "CPU"; }
|
static const char *service_name() { return "CPU"; }
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ namespace Genode {
|
||||||
* \param utcb Base of the UTCB that will be used by the thread
|
* \param utcb Base of the UTCB that will be used by the thread
|
||||||
* \return capability representing the new thread
|
* \return capability representing the new thread
|
||||||
* \throw Thread_creation_failed
|
* \throw Thread_creation_failed
|
||||||
|
* \throw Out_of_metadata
|
||||||
*/
|
*/
|
||||||
virtual Thread_capability create_thread(Name const &name,
|
virtual Thread_capability create_thread(Name const &name,
|
||||||
addr_t utcb = 0) = 0;
|
addr_t utcb = 0) = 0;
|
||||||
|
@ -208,7 +210,7 @@ namespace Genode {
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
GENODE_RPC_THROW(Rpc_create_thread, Thread_capability, create_thread,
|
GENODE_RPC_THROW(Rpc_create_thread, Thread_capability, create_thread,
|
||||||
GENODE_TYPE_LIST(Thread_creation_failed),
|
GENODE_TYPE_LIST(Thread_creation_failed, Out_of_metadata),
|
||||||
Name const &, addr_t);
|
Name const &, addr_t);
|
||||||
GENODE_RPC(Rpc_utcb, Ram_dataspace_capability, utcb, Thread_capability);
|
GENODE_RPC(Rpc_utcb, Ram_dataspace_capability, utcb, Thread_capability);
|
||||||
GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability);
|
GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability);
|
||||||
|
|
|
@ -36,7 +36,7 @@ Thread_capability Cpu_session_component::create_thread(Name const &name,
|
||||||
thread = new(&_thread_alloc) Cpu_thread_component(name.string(),
|
thread = new(&_thread_alloc) Cpu_thread_component(name.string(),
|
||||||
_priority, utcb);
|
_priority, utcb);
|
||||||
} catch (Allocator::Out_of_memory) {
|
} catch (Allocator::Out_of_memory) {
|
||||||
throw Thread_creation_failed();
|
throw Out_of_metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
_thread_list.insert(thread);
|
_thread_list.insert(thread);
|
||||||
|
|
|
@ -36,6 +36,12 @@ namespace Genode {
|
||||||
return new (md_alloc())
|
return new (md_alloc())
|
||||||
Cpu_session_component(_thread_ep, _pager_ep, _md_alloc, args); }
|
Cpu_session_component(_thread_ep, _pager_ep, _md_alloc, args); }
|
||||||
|
|
||||||
|
void _upgrade_session(Cpu_session_component *cpu, const char *args)
|
||||||
|
{
|
||||||
|
size_t ram_quota = Arg_string::find_arg(args, "ram_quota").long_value(0);
|
||||||
|
cpu->upgrade_ram_quota(ram_quota);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -116,6 +116,11 @@ namespace Genode {
|
||||||
*/
|
*/
|
||||||
~Cpu_session_component();
|
~Cpu_session_component();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register quota donation at allocator guard
|
||||||
|
*/
|
||||||
|
void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); }
|
||||||
|
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
** CPU session interface **
|
** CPU session interface **
|
||||||
|
|
Loading…
Reference in New Issue