From 5be3bf4f263e35c868eba7fdd48cb2777d87333d Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 14 Jan 2020 14:11:56 +0100 Subject: [PATCH] init: warn about missing affinity-space if affinity is set by children Issue #1412 --- repos/os/src/init/main.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/repos/os/src/init/main.cc b/repos/os/src/init/main.cc index 05f2f5937..f369c1b9b 100644 --- a/repos/os/src/init/main.cc +++ b/repos/os/src/init/main.cc @@ -319,6 +319,7 @@ void Init::Main::_handle_config() Prio_levels const prio_levels = prio_levels_from_xml(_config_xml); Affinity::Space const affinity_space = affinity_space_from_xml(_config_xml); + bool const space_defined = _config_xml.has_sub_node("affinity-space"); _update_aliases_from_config(); _update_parent_services_from_config(); @@ -361,8 +362,10 @@ void Init::Main::_handle_config() unsigned num_abandoned = 0; + Child_policy::Name const child_name(start_node.attribute_value("name", Child_policy::Name())); + _children.for_each_child([&] (Child const &child) { - if (child.name() == start_node.attribute_value("name", Child_policy::Name())) { + if (child.name() == child_name) { if (child.abandoned()) num_abandoned++; else @@ -379,15 +382,20 @@ void Init::Main::_handle_config() return; if (used_ram.value > avail_ram.value) { - error("RAM exhausted while starting childen"); + error("RAM exhausted while starting child: ", child_name); return; } if (used_caps.value > avail_caps.value) { - error("capabilities exhausted while starting childen"); + error("capabilities exhausted while starting child: ", child_name); return; } + if (!space_defined && start_node.has_sub_node("affinity")) { + warning("affinity-space configuration missing, " + "but affinity defined for child: ", child_name); + } + try { Init::Child &child = *new (_heap) Init::Child(_env, _heap, *_verbose, @@ -453,7 +461,7 @@ void Init::Main::_handle_config() child.initiate_env_sessions(); }); /* - * (Re-)distribute RAM and capability quota among the childen, given their + * (Re-)distribute RAM and capability quota among the children, given their * resource assignments and the available slack memory. We first apply * possible downgrades to free as much resources as we can. These resources * are then incorporated in the subsequent upgrade step.