mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-29 18:18:54 +00:00
1f58b05255
The commits avoids reading in and allocating memory for all potentially threads, which are potentially currently not existent (but configured in the policy beforehand). Instead the policy is read in and evaluated when a thread is created and policy changes are solely applied to existing/running threads. By this the commit avoids the increase of memory consumption during the evaluation of policies during config ROM updates. Issue #4333
171 lines
5.0 KiB
Plaintext
171 lines
5.0 KiB
Plaintext
build "core init timer server/cpu_balancer app/cpu_burner app/top server/dynamic_rom"
|
|
|
|
if {![have_include "power_on/qemu"]} {
|
|
puts "Run script is not supported on this platform"
|
|
exit 0
|
|
}
|
|
if {[have_spec foc] && ([have_board pbxa9] || [have_board rpi3])} {
|
|
# foc kernel does detect solely 1 CPU */
|
|
puts "Run script is not supported on this platform"
|
|
exit 0
|
|
}
|
|
if {![have_spec nova] && ![have_spec foc] && ![have_spec sel4]} {
|
|
puts "Run script is not supported on this platform"
|
|
exit 0
|
|
}
|
|
|
|
set cpu_width 4
|
|
set cpu_height 1
|
|
set report_config "yes"
|
|
set use_trace "yes"
|
|
|
|
create_boot_directory
|
|
|
|
import_from_depot [depot_user]/src/report_rom \
|
|
[depot_user]/src/shim
|
|
|
|
append config {
|
|
<config prio_levels="2" verbose="yes">
|
|
<affinity-space width="} $cpu_width {" height="} $cpu_height {"/>
|
|
<parent-provides>
|
|
<service name="LOG"/>
|
|
<service name="CPU"/>
|
|
<service name="ROM"/>
|
|
<service name="PD"/>
|
|
<service name="IO_PORT"/> <!-- timer on some kernels -->
|
|
<service name="IRQ"/> <!-- timer on some kernels -->
|
|
<service name="TRACE"/>
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="PD"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
</default-route>
|
|
<default caps="100"/>
|
|
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
<route>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>}
|
|
|
|
append_if [expr $report_config eq "yes"] config {
|
|
<start name="report_rom">
|
|
<binary name="report_rom"/>
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
<config verbose="yes"/>
|
|
<route>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>}
|
|
|
|
append config {
|
|
<start name="dynamic_rom">
|
|
<resource name="RAM" quantum="4M"/>
|
|
<provides><service name="ROM"/> </provides>
|
|
<config verbose="yes">
|
|
<rom name="cpu_balancer.config">
|
|
<inline>
|
|
<config interval_us="2000000"
|
|
report="} $report_config {"
|
|
trace="} $use_trace {"
|
|
verbose="no">
|
|
<component label="cpu_burner -> " default_policy="none">
|
|
<!--
|
|
<thread name="signal handler" policy="pin" xpos="1" ypos="0"/>
|
|
-->
|
|
<thread name="signal handler" policy="max-utilize"/>
|
|
<thread name="burn_0x0" policy="round-robin"/>
|
|
<thread name="burn_1x0" policy="round-robin"/>
|
|
</component>
|
|
</config>
|
|
</inline>
|
|
<sleep milliseconds="2000"/>
|
|
<inline>
|
|
<config interval_us="2000000"
|
|
report="} $report_config {"
|
|
trace="} $use_trace {"
|
|
verbose="no">
|
|
<component label="cpu_burner -> " default_policy="none">
|
|
<!--
|
|
<thread name="signal handler" policy="pin" xpos="1" ypos="0"/>
|
|
-->
|
|
<thread name="signal handler" policy="max-utilize"/>
|
|
<thread name="burn_0x0" policy="round-robin"/>
|
|
<thread name="burn_1x0" policy="round-robin"/>
|
|
<thread name="not_existent" policy="round-robin"/>
|
|
</component>
|
|
</config>
|
|
</inline>
|
|
<sleep milliseconds="2000"/>
|
|
</rom>
|
|
</config>
|
|
<route>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>}
|
|
|
|
append config {
|
|
<start name="cpu_balancer" caps="120">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<provides>
|
|
<service name="PD"/>
|
|
<service name="CPU"/>
|
|
</provides>
|
|
<route>
|
|
<service name="ROM" label="config">
|
|
<child name="dynamic_rom" label="cpu_balancer.config"/>
|
|
</service>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="cpu_burner" priority="-1" caps="120">
|
|
<binary name="shim"/>
|
|
<affinity xpos="1" ypos="0" width="2" height="1"/>
|
|
<resource name="RAM" quantum="3M"/>
|
|
<route>
|
|
|
|
<!-- by shim binary -->
|
|
<service name="PD" unscoped_label="cpu_burner"> <parent/> </service>
|
|
<service name="CPU" unscoped_label="cpu_burner"> <parent/> </service>
|
|
|
|
<!-- by child of shim -->
|
|
<service name="PD"> <child name="cpu_balancer"/> </service>
|
|
<service name="CPU"> <child name="cpu_balancer"/> </service>
|
|
|
|
<service name="ROM" label="binary"> <parent label="cpu_burner"/> </service>
|
|
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="LOG"> <parent/> </service>
|
|
<service name="ROM"> <parent/> </service>
|
|
</route>
|
|
</start>
|
|
<!--
|
|
<start name="top">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<route>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<service name="CPU"> <child name="cpu_balancer"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>
|
|
-->
|
|
</config>}
|
|
|
|
install_config $config
|
|
|
|
build_boot_image { core ld.lib.so init timer cpu_balancer cpu_burner top dynamic_rom }
|
|
|
|
append qemu_args " -nographic"
|
|
append qemu_args " -smp [expr $cpu_width * $cpu_height],cores=$cpu_width,threads=$cpu_height"
|
|
|
|
run_genode_until {.*thread xpos="1" ypos="0" name="signal handler" policy="max-utilize".*\n} 60
|