os: avoid blocking on resource request in bomb.run

that are caused by bomb clients.

Issue #1632
This commit is contained in:
Alexander Boettcher 2015-07-15 13:56:31 +02:00 committed by Norman Feske
parent fe4e0702d4
commit 4cf319a9d7
2 changed files with 35 additions and 9 deletions

View File

@ -1,8 +1,18 @@
build "core init test/bomb drivers/timer"
create_boot_directory
set timeout 240
set rounds 20
install_config {
if {[have_include "power_on/qemu"]} {
append qemu_args "-nographic -m 128"
} else {
# foc is really slow on native hardware executing this test - limit rounds
if {[have_spec foc_x86_32]} { set rounds 6 }
if {[have_spec foc_x86_64]} { set rounds 6 }
}
set config {
<config prio_levels="2">
<parent-provides>
<service name="ROM"/>
@ -21,20 +31,28 @@ install_config {
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="timer">
<resource name="CPU" quantum="10"/>
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="bomb-master" priority="-1">
<binary name="bomb"/>
<resource name="RAM" quantum="2G"/>
<config rounds="20" generations="6" sleep="1500"/>
<resource name="CPU" quantum="90"/>
<resource name="RAM" quantum="2G"/>}
append config "
<config rounds=\"$rounds\" generations=\"6\" sleep=\"1500\"/>"
append config {
</start>
</config>}
create_boot_directory
install_config $config
build_boot_image "core init bomb timer"
append qemu_args "-nographic -m 128"
run_genode_until "Done\. Going to sleep\." 300
run_genode_until "Done\. Going to sleep\." $timeout
puts "Test succeeded."

View File

@ -278,6 +278,14 @@ int main(int argc, char **argv)
/* is init our parent? */
if (!timer()) sleep_forever();
/* don't ask parent for further resources if we ran out of memory */
static Signal_receiver sig_rec;
static Signal_context sig_ctx_res_avail;
if (round == 0) {
/* prevent to block for resource upgrades caused by clients */
env()->parent()->resource_avail_sigh(sig_rec.manage(&sig_ctx_res_avail));
}
timer()->msleep(sleeptime);
PINF("[%03d] It's time to kill all my children...", round);
@ -296,8 +304,8 @@ int main(int argc, char **argv)
PINF("[%03d] Done.", round);
}
/* master if rounds != 0 */
if (rounds != 0)
/* master if we have a timer connection */
if (timer())
PINF("Done. Going to sleep");
sleep_forever();