mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
hoitija: Removed old TASKING service.
This commit is contained in:
@@ -136,5 +136,4 @@ void Hoitaja::Habitat::update(Cell &cell)
|
|||||||
void Hoitaja::Core_allocation_request::handle(Hoitaja::Cell&, Hoitaja::Habitat&)
|
void Hoitaja::Core_allocation_request::handle(Hoitaja::Cell&, Hoitaja::Habitat&)
|
||||||
{
|
{
|
||||||
Genode::Parent::Resource_args grant_args("cpu_quota=10");
|
Genode::Parent::Resource_args grant_args("cpu_quota=10");
|
||||||
client().send_request(grant_args);
|
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <core_allocator.h>
|
#include <core_allocator.h>
|
||||||
#include <cell.h>
|
#include <cell.h>
|
||||||
#include <state_handler.h>
|
#include <state_handler.h>
|
||||||
#include <suoritin/component.h>
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
namespace Hoitaja {
|
namespace Hoitaja {
|
||||||
@@ -35,11 +34,9 @@ struct Hoitaja::Habitat : public Sandbox::Library
|
|||||||
Heap _heap;
|
Heap _heap;
|
||||||
Sliced_heap suoritin_heap;
|
Sliced_heap suoritin_heap;
|
||||||
|
|
||||||
Entrypoint suoritin_ep{_env, 4 * 4096, "suoritin", Affinity::Location()};
|
|
||||||
|
|
||||||
Genode::Constructible<Hoitaja::Core_allocator> _core_allocator;
|
Genode::Constructible<Hoitaja::Core_allocator> _core_allocator;
|
||||||
|
|
||||||
Tukija::Suoritin::Root_component suoritin;
|
|
||||||
|
|
||||||
Registry<Genode::Sandbox::Local_service_base>
|
Registry<Genode::Sandbox::Local_service_base>
|
||||||
_local_services{};
|
_local_services{};
|
||||||
@@ -66,9 +63,8 @@ struct Hoitaja::Habitat : public Sandbox::Library
|
|||||||
|
|
||||||
Habitat(Env &env, State_handler &habitat_handler, Genode::Sandbox::State_handler &handler)
|
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()),
|
: 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;
|
Sandbox::Child &create_child(Xml_node const &) override;
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
#include "core_allocator.h"
|
#include "core_allocator.h"
|
||||||
/* State Handler */
|
/* State Handler */
|
||||||
#include "state_handler.h"
|
#include "state_handler.h"
|
||||||
/* Tasking Service Suoritin */
|
|
||||||
#include <suoritin/component.h>
|
|
||||||
|
|
||||||
namespace Hoitaja {
|
namespace Hoitaja {
|
||||||
|
|
||||||
@@ -40,15 +38,13 @@ namespace Hoitaja {
|
|||||||
struct Main;
|
struct Main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler
|
struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
Env &_env;
|
Env &_env;
|
||||||
|
|
||||||
Entrypoint timer_ep{_env, 4 * 4096, "hoitaja_timer", Affinity::Location()};
|
|
||||||
|
|
||||||
Habitat _sandbox { _env, *this, *this };
|
Habitat _sandbox { _env, *this, *this };
|
||||||
|
|
||||||
Timer::Connection _timer{_env};
|
Timer::Connection _timer{_env};
|
||||||
|
|
||||||
Attached_rom_dataspace _config { _env, "config" };
|
Attached_rom_dataspace _config { _env, "config" };
|
||||||
@@ -64,6 +60,7 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler
|
|||||||
|
|
||||||
void _handle_config()
|
void _handle_config()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
_config.update();
|
_config.update();
|
||||||
|
|
||||||
Xml_node const config = _config.xml();
|
Xml_node const config = _config.xml();
|
||||||
@@ -87,22 +84,25 @@ struct Hoitaja::Main : Genode::Sandbox::State_handler, Hoitaja::State_handler
|
|||||||
_reporter->enabled(reporter_enabled);
|
_reporter->enabled(reporter_enabled);
|
||||||
|
|
||||||
_sandbox.apply_config(config);
|
_sandbox.apply_config(config);
|
||||||
|
} catch (Genode::Quota_guard<Genode::Cap_quota>::Limit_exceeded&)
|
||||||
|
{
|
||||||
|
Genode::error("Caps exceeded while handling configuration change.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Signal_handler<Main> _config_handler {
|
Signal_handler<Main> _config_handler {
|
||||||
_env.ep(), *this, &Main::_handle_config };
|
_env.ep(), *this, &Main::_handle_config };
|
||||||
|
|
||||||
void _handle_timeout()
|
void handle_timeout(Genode::Duration)
|
||||||
{
|
{
|
||||||
log("Hoitaja's entering its maintance cycle");
|
//Genode::log("Hoitaja woke up after ", (now - last) / 2000, " us");
|
||||||
// For now just print all cells created by Hoitaja
|
|
||||||
//_handle_config();
|
|
||||||
_sandbox.maintain_cells();
|
_sandbox.maintain_cells();
|
||||||
_timer.trigger_once(10*1000 * 1000);
|
|
||||||
|
_timeout.schedule(Genode::Microseconds{20});
|
||||||
}
|
}
|
||||||
|
|
||||||
Signal_handler<Main> _timeout_handler{
|
Timer::One_shot_timeout<Main> _timeout{_timer, *this, &Main::handle_timeout};
|
||||||
timer_ep, *this, &Main::_handle_timeout};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sandbox::State_handler interface
|
* 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
|
void handle_habitat_state(Cell &cell) override
|
||||||
{
|
{
|
||||||
Genode::log("Habitat changed");
|
Genode::log("Habitat changed");
|
||||||
_sandbox.update(cell);
|
try {
|
||||||
|
_sandbox.update(cell);
|
||||||
|
} catch (Genode::Quota_guard<Genode::Cap_quota>::Limit_exceeded) {
|
||||||
|
Genode::log("CAP quota exceeded in state handler");
|
||||||
|
_env.parent().exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Main(Env &env) : _env(env)
|
Main(Env &env) : _env(env)
|
||||||
{
|
{
|
||||||
_config.sigh(_config_handler);
|
_config.sigh(_config_handler);
|
||||||
_timer.sigh(_timeout_handler);
|
|
||||||
|
|
||||||
/* prevent init to block for resource upgrades (never satisfied by core) */
|
/* 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();
|
_handle_config();
|
||||||
|
|
||||||
Genode::log("Starting TASKING service");
|
Genode::log("Affinity space: ", env.cpu().affinity_space());
|
||||||
|
|
||||||
|
_timeout.schedule(Genode::Microseconds{20});
|
||||||
_timer.trigger_once(1000 * 1000);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user