diff --git a/repos/os/src/hoitaja/habitat.cc b/repos/os/src/hoitaja/habitat.cc index d82e2576e0..0b35348335 100644 --- a/repos/os/src/hoitaja/habitat.cc +++ b/repos/os/src/hoitaja/habitat.cc @@ -102,6 +102,17 @@ void Hoitaja::Habitat::maintain_cells() log(child.name(), " ram: ", child.ram_quota()); Cell &cell = static_cast(child); _core_allocator->update(cell, &xpos); }); + suoritin.for_each([&](Tukija::Suoritin::Session_component &client) + { Genode::log("Cell ", client.label(), "\n------------"); + for (unsigned long channel_id = 0; channel_id < client.channels(); channel_id++) { + Tukija::Suoritin::Channel &channel = client.channels_if()[channel_id]; + Genode::log("\t", "Channel ", channel_id, ": length=", channel.length(), " worker=", client.worker(channel._worker).name(), ",", client.worker(channel._worker).cap() ); + if (channel.length() > 0xFFFF) { + Genode::Parent::Resource_args grant_args("cpu_quota=10"); + client.send_request(grant_args); + } + } + }); } void Hoitaja::Habitat::update(Cell &cell) diff --git a/repos/os/src/hoitaja/habitat.h b/repos/os/src/hoitaja/habitat.h index 7a58b658fb..1b1e913497 100644 --- a/repos/os/src/hoitaja/habitat.h +++ b/repos/os/src/hoitaja/habitat.h @@ -17,6 +17,7 @@ #include #include #include +#include #pragma once namespace Hoitaja { @@ -32,9 +33,14 @@ struct Hoitaja::Habitat : public Sandbox::Library State_handler &_habitat_handler; Heap _heap; + Sliced_heap suoritin_heap; + + Entrypoint suoritin_ep{_env, 4 * 4096, "suoritin", Affinity::Location()}; Genode::Constructible _core_allocator; + Tukija::Suoritin::Root_component suoritin; + Registry _local_services{}; @@ -59,8 +65,10 @@ struct Hoitaja::Habitat : public Sandbox::Library void update(Cell &cell); Habitat(Env &env, State_handler &habitat_handler, Genode::Sandbox::State_handler &handler) - : Sandbox::Library(env, _heap, _local_services, handler), _habitat_handler(habitat_handler), _heap(env.ram(), env.rm()), _core_allocator() + : Sandbox::Library(env, _heap, _local_services, handler), _habitat_handler(habitat_handler), _heap(env.ram(), env.rm()), + suoritin_heap(env.ram(), env.rm()), _core_allocator(), suoritin(env, suoritin_heap) { + env.parent().announce(suoritin_ep.manage(suoritin)); } Sandbox::Child &create_child(Xml_node const &) override; diff --git a/repos/os/src/hoitaja/main.cc b/repos/os/src/hoitaja/main.cc index 9b9c682f0f..cf6521b8af 100644 --- a/repos/os/src/hoitaja/main.cc +++ b/repos/os/src/hoitaja/main.cc @@ -45,9 +45,9 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler { Env &_env; - Habitat _sandbox { _env, *this, *this }; + Entrypoint timer_ep{_env, 4 * 4096, "hoitaja_timer", Affinity::Location()}; - Entrypoint suoritin_ep{_env, 4 * 4096, "suoritin", Affinity::Location()}; + Habitat _sandbox { _env, *this, *this }; Timer::Connection _timer{_env}; @@ -94,14 +94,15 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler void _handle_timeout() { - //log("Hoitaja's entering its maintance cycle"); + log("Hoitaja's entering its maintance cycle"); // For now just print all cells created by Hoitaja //_handle_config(); - //_timer.trigger_once(1000 * 1000); + _sandbox.maintain_cells(); + _timer.trigger_once(10*1000 * 1000); } Signal_handler
_timeout_handler{ - _env.ep(), *this, &Main::_handle_timeout}; + timer_ep, *this, &Main::_handle_timeout}; /** * Sandbox::State_handler interface @@ -143,12 +144,9 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler _handle_config(); Genode::log("Starting TASKING service"); - static Genode::Sliced_heap sliced_heap{env.ram(), env.rm()}; - static Tukija::Suoritin::Root_component suoritin(env, sliced_heap); - env.parent().announce(suoritin_ep.manage(suoritin)); - //_timer.trigger_once(1000 * 1000); + _timer.trigger_once(1000 * 1000); } };