mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-26 00:41:08 +00:00
5fe29e8e4a
This patch introduces new types for expressing CPU affinities. Instead of dealing with physical CPU numbers, affinities are expressed as rectangles in a grid of virtual CPU nodes. This clears the way to conveniently assign sets of adjacent CPUs to subsystems, each of them managing their respective viewport of the coordinate space. By using 2D Cartesian coordinates, the locality of CPU nodes can be modeled for different topologies such as SMP (simple Nx1 grid), grids of NUMA nodes, or ring topologies.
68 lines
1.5 KiB
Plaintext
68 lines
1.5 KiB
Plaintext
#
|
|
# \brief Test to start threads on all available CPUs
|
|
# \author Norman Feske
|
|
# \author Alexander Boettcher
|
|
#
|
|
|
|
if {[have_spec platform_pbxa9] || (![have_spec nova] && ![have_spec foc])} {
|
|
puts "Platform is unsupported."
|
|
exit 0
|
|
}
|
|
|
|
|
|
build "core init test/affinity"
|
|
|
|
create_boot_directory
|
|
|
|
install_config {
|
|
<config>
|
|
<parent-provides>
|
|
<service name="LOG"/>
|
|
<service name="CPU"/>
|
|
<service name="RM"/>
|
|
</parent-provides>
|
|
<default-route>
|
|
<any-service> <parent/> </any-service>
|
|
</default-route>
|
|
<start name="test-affinity">
|
|
<resource name="RAM" quantum="10M"/>
|
|
</start>
|
|
</config>
|
|
}
|
|
|
|
build_boot_image "core init test-affinity"
|
|
|
|
if {[is_qemu_available]} {
|
|
set want_cpus_x 4
|
|
set want_cpus_y 1
|
|
set want_cpus_total [expr $want_cpus_x*$want_cpus_y]
|
|
set rounds "03"
|
|
append qemu_args "-nographic -m 64 -smp $want_cpus_total,cores=$want_cpus_total "
|
|
} else {
|
|
set rounds "10"
|
|
if {[have_spec x86]} { set rounds "40" }
|
|
}
|
|
|
|
run_genode_until "Round $rounds:.*\n" 90
|
|
|
|
set cpus [regexp -inline {Detected [0-9x]+ CPU[ s]\.} $output]
|
|
set cpus [regexp -all -inline {[0-9]+} $cpus]
|
|
set cpus [expr [lindex $cpus 0] * [lindex $cpus 1]]
|
|
|
|
if {[is_qemu_available]} {
|
|
if {$want_cpus_total != $cpus} {
|
|
puts "CPU count is not as expected: $want_cpus_total != $cpus"
|
|
exit 1;
|
|
}
|
|
}
|
|
|
|
set good_string {[init -> test-affinity] Round XX:}
|
|
for {set i 0} {$i < $cpus} {incr i} {
|
|
append good_string " A"
|
|
}
|
|
|
|
grep_output {\[init -\> test-affinity\] Round}
|
|
unify_output {[0-9]+} "XX"
|
|
|
|
compare_output_to $good_string
|