2013-07-19 13:46:24 +00:00
|
|
|
#
|
|
|
|
# \brief Test to start and call RPC entrypoint on all available CPUs
|
2018-11-13 14:12:29 +00:00
|
|
|
# \author Stefan Kalkowski
|
2013-07-19 13:46:24 +00:00
|
|
|
# \author Norman Feske
|
2014-03-06 12:13:15 +00:00
|
|
|
# \author Alexander Boettcher
|
2013-07-19 13:46:24 +00:00
|
|
|
#
|
|
|
|
|
2018-11-14 14:06:52 +00:00
|
|
|
if { [get_cmd_switch --autopilot] && [have_include "power_on/qemu"] } {
|
|
|
|
puts "Run script does not support autopilot mode on Qemu"
|
|
|
|
exit 0
|
|
|
|
}
|
2013-07-19 13:46:24 +00:00
|
|
|
|
2019-02-11 13:41:14 +00:00
|
|
|
if { [have_spec muen] } {
|
|
|
|
puts "Run script is not supported on this platform"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:12:29 +00:00
|
|
|
build "core init test/smp"
|
2013-07-19 13:46:24 +00:00
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
install_config {
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="CPU"/>
|
2017-01-18 16:10:07 +00:00
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="PD"/>
|
2013-07-19 13:46:24 +00:00
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</default-route>
|
2017-05-07 20:36:11 +00:00
|
|
|
<default caps="100"/>
|
2018-11-13 14:12:29 +00:00
|
|
|
<start name="test-smp">
|
2013-07-19 13:46:24 +00:00
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:12:29 +00:00
|
|
|
build_boot_image "core ld.lib.so init test-smp"
|
2013-07-19 13:46:24 +00:00
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
if {[have_include "power_on/qemu"]} {
|
2015-03-18 10:35:02 +00:00
|
|
|
# in general we want to have at least 2 CPUs
|
2013-07-19 13:46:24 +00:00
|
|
|
set want_cpus 2
|
2015-03-18 10:35:02 +00:00
|
|
|
|
|
|
|
# pbxa9 - foc does only use 1 cpu even if more are configured
|
|
|
|
# pbxa9 - hw does not support multiple CPUs
|
2015-09-03 12:55:05 +00:00
|
|
|
if {[have_spec pbxa9]} { set want_cpus 1 }
|
2016-07-19 11:55:59 +00:00
|
|
|
# kernels only using one CPU even if more are configured
|
2017-01-03 12:17:41 +00:00
|
|
|
if {[have_spec okl4]} { set want_cpus 1 }
|
|
|
|
if {[have_spec pistachio]} { set want_cpus 1 }
|
|
|
|
if {[have_spec fiasco]} { set want_cpus 1 }
|
|
|
|
if {[have_spec zynq]} { set want_cpus 1 }
|
2015-03-18 10:35:02 +00:00
|
|
|
|
2017-05-23 13:05:55 +00:00
|
|
|
append qemu_args " -nographic -smp $want_cpus,cores=$want_cpus "
|
2013-07-19 13:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# run the test
|
2018-11-13 14:12:29 +00:00
|
|
|
run_genode_until {\[init -\> test-smp\] --- SMP testsuite finished.*\n} 120
|
2013-07-19 13:46:24 +00:00
|
|
|
|
2015-03-18 10:35:02 +00:00
|
|
|
set cpus [regexp -inline {Detected [0-9x]+ CPU[s\.]} $output]
|
2013-08-07 20:16:58 +00:00
|
|
|
set cpus [regexp -all -inline {[0-9]+} $cpus]
|
|
|
|
set cpus [expr [lindex $cpus 0] * [lindex $cpus 1]]
|
2013-07-19 13:46:24 +00:00
|
|
|
|
2015-01-08 21:09:08 +00:00
|
|
|
if {[have_include "power_on/qemu"]} {
|
2013-07-19 13:46:24 +00:00
|
|
|
if {$want_cpus != $cpus} {
|
|
|
|
puts "CPU count is not as expected: $want_cpus != $cpus"
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:12:29 +00:00
|
|
|
set original_output $output
|
|
|
|
grep_output {\[init -\> test-smp\] RPC:}
|
2013-07-19 13:46:24 +00:00
|
|
|
unify_output {transfer cap [a-f0-9]+} "transfer cap UNIFIED"
|
|
|
|
unify_output {yes - idx [a-f0-9]+} "yes - idx UNIFIED"
|
|
|
|
unify_output {\- received cap [a-f0-9]+} "- received cap UNIFIED"
|
|
|
|
|
2018-11-13 14:12:29 +00:00
|
|
|
set good_string {[init -> test-smp] RPC: --- test started ---
|
|
|
|
}
|
2014-07-17 16:09:45 +00:00
|
|
|
for {set r 0} {$r < $cpus} {incr r} {
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: call server on CPU }
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "$r\n"
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: function test_untyped: got value }
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "$r\n"
|
|
|
|
}
|
|
|
|
for {set r 0} {$r < $cpus} {incr r} {
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: call server on CPU }
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "$r - transfer cap UNIFIED\n"
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: function test_cap: capability is valid ? yes - idx UNIFIED}
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "\n"
|
2013-07-19 13:46:24 +00:00
|
|
|
}
|
2014-07-17 16:09:45 +00:00
|
|
|
for {set r 0} {$r < $cpus} {incr r} {
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: call server on CPU }
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "$r - transfer cap UNIFIED\n"
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: function test_cap_reply: capability is valid ? yes - idx UNIFIED}
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "\n"
|
2018-11-13 14:12:29 +00:00
|
|
|
append good_string {[init -> test-smp] RPC: got from server on CPU }
|
2014-07-17 16:09:45 +00:00
|
|
|
append good_string "$r - received cap UNIFIED\n"
|
|
|
|
}
|
|
|
|
compare_output_to $good_string
|
2018-11-13 14:12:29 +00:00
|
|
|
puts "RPC test: passed"
|
|
|
|
|
|
|
|
set output $original_output
|
|
|
|
grep_output {\[init -\> test-smp\] Affinity: Round}
|
|
|
|
set rounds "10"
|
|
|
|
set good_string {}
|
|
|
|
for {set r 0} {$r <= $rounds} {incr r} {
|
|
|
|
append good_string {[init -> test-smp] Affinity: Round }
|
|
|
|
append good_string [format "%02d" $r]
|
|
|
|
append good_string ":"
|
|
|
|
for {set i 0} {$i < $cpus} {incr i} {
|
|
|
|
append good_string " A"
|
|
|
|
}
|
|
|
|
append good_string "\n"
|
|
|
|
}
|
|
|
|
compare_output_to $good_string
|
|
|
|
puts "Affinity test: passed"
|
2018-11-14 14:06:52 +00:00
|
|
|
|
|
|
|
set output $original_output
|
|
|
|
grep_output {no RM attachment }
|
|
|
|
unify_output {pf_addr=0x[a-f0-9]+} "ADDR"
|
|
|
|
unify_output {pf_ip=0x[a-f0-9]+} "IP"
|
|
|
|
set good_string ""
|
|
|
|
for {set r 1} {$r < $cpus} {incr r} {
|
|
|
|
append good_string {no RM attachment (READ ADDR IP from pager_object: pd='init -> test-smp' thread='tlb_thread')}
|
|
|
|
append good_string "\n"
|
|
|
|
}
|
|
|
|
compare_output_to $good_string
|
|
|
|
puts "TLB test: passed"
|