init: reduce report latency for resource requests

In contrast to most information of init's state reports, which can be
monitored at a relatively low rate (like 2 seconds in Sculpt's runtime),
resource requests call for an immediate response by the consumer of the
report. Otherwise the requesting child stays unnecessarily blocked until
the next rate-limited state report is due. This patch adds a fast lane
for such low-latency state updates to init.
This commit is contained in:
Norman Feske 2018-06-01 13:55:07 +02:00 committed by Christian Helmuth
parent 4bfc32789e
commit 7791937e84
4 changed files with 25 additions and 2 deletions

View File

@ -641,7 +641,7 @@ void Init::Child::resource_request(Parent::Resource_args const &args)
log("child \"", name(), "\" requests resources: ", args);
_requested_resources.construct(args);
_report_update_trigger.trigger_report_update();
_report_update_trigger.trigger_immediate_report_update();
}

View File

@ -68,7 +68,20 @@ class Init::Report_detail : Genode::Noncopyable
struct Init::Report_update_trigger : Interface
{
/**
* Trigger regular (rate-limited) report update
*/
virtual void trigger_report_update() = 0;
/**
* Trigger immediate report update
*
* This method is intended for situations that require a timely response of
* the consumer of the report. This is particularly important for resource
* requests that would otherwise unnecessarily stall the execution of the
* respective child.
*/
virtual void trigger_immediate_report_update() = 0;
};
#endif /* _SRC__INIT__REPORT_H_ */

View File

@ -63,6 +63,9 @@ class Init::State_reporter : public Report_update_trigger
Signal_handler<State_reporter> _timer_periodic_handler {
_env.ep(), *this, &State_reporter::_handle_timer };
Signal_handler<State_reporter> _immediate_handler {
_env.ep(), *this, &State_reporter::_handle_timer };
bool _scheduled = false;
void _handle_timer()
@ -183,6 +186,12 @@ class Init::State_reporter : public Report_update_trigger
_scheduled = true;
}
}
void trigger_immediate_report_update() override
{
if (_report_delay_ms)
Signal_transmitter(_immediate_handler).submit();
}
};
#endif /* _SRC__INIT__STATE_REPORTER_H_ */

View File

@ -172,9 +172,10 @@ class Gdb_monitor::App_child : public Child_policy,
}
/**
* Init::Report_update_trigger callback
* Init::Report_update_trigger callbacks
*/
void trigger_report_update() override { }
void trigger_immediate_report_update() override { }
/**
* Init::Routed_service::Ram_accessor interface