From 48b2d725a874e88e45ea1e59d2f4c39b6b6d0a6b Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 11 Mar 2024 14:44:11 +0100 Subject: [PATCH] hoitija: Removed old TASKING service. --- repos/os/src/hoitaja/habitat.cc | 1 - repos/os/src/hoitaja/habitat.h | 6 +---- repos/os/src/hoitaja/main.cc | 43 ++++++++++++++++++--------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/repos/os/src/hoitaja/habitat.cc b/repos/os/src/hoitaja/habitat.cc index 8a36dcfe4f..40e668a2c4 100644 --- a/repos/os/src/hoitaja/habitat.cc +++ b/repos/os/src/hoitaja/habitat.cc @@ -136,5 +136,4 @@ void Hoitaja::Habitat::update(Cell &cell) void Hoitaja::Core_allocation_request::handle(Hoitaja::Cell&, Hoitaja::Habitat&) { Genode::Parent::Resource_args grant_args("cpu_quota=10"); - client().send_request(grant_args); } \ No newline at end of file diff --git a/repos/os/src/hoitaja/habitat.h b/repos/os/src/hoitaja/habitat.h index 1b1e913497..49ff8a7eee 100644 --- a/repos/os/src/hoitaja/habitat.h +++ b/repos/os/src/hoitaja/habitat.h @@ -17,7 +17,6 @@ #include #include #include -#include #pragma once namespace Hoitaja { @@ -35,11 +34,9 @@ struct Hoitaja::Habitat : public Sandbox::Library 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{}; @@ -66,9 +63,8 @@ struct Hoitaja::Habitat : public Sandbox::Library 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()), - suoritin_heap(env.ram(), env.rm()), _core_allocator(), suoritin(env, suoritin_heap) + suoritin_heap(env.ram(), env.rm()), _core_allocator() { - 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 cf6521b8af..077c64c2b7 100644 --- a/repos/os/src/hoitaja/main.cc +++ b/repos/os/src/hoitaja/main.cc @@ -30,8 +30,6 @@ #include "core_allocator.h" /* State Handler */ #include "state_handler.h" -/* Tasking Service Suoritin */ -#include namespace Hoitaja { @@ -40,17 +38,15 @@ namespace Hoitaja { struct Main; } - struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler { + + Env &_env; - Entrypoint timer_ep{_env, 4 * 4096, "hoitaja_timer", Affinity::Location()}; - Habitat _sandbox { _env, *this, *this }; - Timer::Connection _timer{_env}; - + Attached_rom_dataspace _config { _env, "config" }; void _handle_resource_avail() { } @@ -64,6 +60,7 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler void _handle_config() { + try { _config.update(); Xml_node const config = _config.xml(); @@ -87,22 +84,25 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler _reporter->enabled(reporter_enabled); _sandbox.apply_config(config); + } catch (Genode::Quota_guard::Limit_exceeded&) + { + Genode::error("Caps exceeded while handling configuration change."); + } } Signal_handler
_config_handler { _env.ep(), *this, &Main::_handle_config }; - void _handle_timeout() + void handle_timeout(Genode::Duration) { - log("Hoitaja's entering its maintance cycle"); - // For now just print all cells created by Hoitaja - //_handle_config(); + //Genode::log("Hoitaja woke up after ", (now - last) / 2000, " us"); + _sandbox.maintain_cells(); - _timer.trigger_once(10*1000 * 1000); + + _timeout.schedule(Genode::Microseconds{20}); } - Signal_handler
_timeout_handler{ - timer_ep, *this, &Main::_handle_timeout}; + Timer::One_shot_timeout
_timeout{_timer, *this, &Main::handle_timeout}; /** * Sandbox::State_handler interface @@ -131,22 +131,25 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler void handle_habitat_state(Cell &cell) override { Genode::log("Habitat changed"); - _sandbox.update(cell); + try { + _sandbox.update(cell); + } catch (Genode::Quota_guard::Limit_exceeded) { + Genode::log("CAP quota exceeded in state handler"); + _env.parent().exit(1); + } } Main(Env &env) : _env(env) { _config.sigh(_config_handler); - _timer.sigh(_timeout_handler); /* prevent init to block for resource upgrades (never satisfied by core) */ - _env.parent().resource_avail_sigh(_resource_avail_handler); + //_env.parent().resource_avail_sigh(_resource_avail_handler); _handle_config(); - Genode::log("Starting TASKING service"); - + Genode::log("Affinity space: ", env.cpu().affinity_space()); - _timer.trigger_once(1000 * 1000); + _timeout.schedule(Genode::Microseconds{20}); } };