Add test which verifies capacity calculation on arm
architecture platforms.
Since there isn't yet a similar calculation done
for arm64 platforms, this architecture isn't supported
by this test (at least as of now).
Signed-off-by: Larry Bassel <larry.bassel(a)linaro.org>
---
cputopology/cputopology_04.sh | 127 +++++++++++++++++++++++++++++++++++++++++
cputopology/cputopology_04.txt | 1 +
2 files changed, 128 insertions(+)
create mode 100755 cputopology/cputopology_04.sh
create mode 100644 cputopology/cputopology_04.txt
diff --git a/cputopology/cputopology_04.sh b/cputopology/cputopology_04.sh
new file mode 100755
index 0000000..d66c1c8
--- /dev/null
+++ b/cputopology/cputopology_04.sh
@@ -0,0 +1,127 @@
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2015, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributors:
+# Larry Bassel <larry.bassel(a)linaro.org>
+#
+
+# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/P…
+
+source ../include/functions.sh
+
+calc_freq()
+{
+ byte1=$1
+ byte2=$2
+ byte3=$3
+ byte4=$4
+ freq=$((byte1*0x1000000+byte2*0x10000+byte3*0x100+byte4))
+}
+
+set_eff() {
+ type=$1
+
+ case $type in
+ arm,cortex-a15) eff=3891 ;;
+ arm,cortex-a7) eff=2048 ;;
+ * ) eff=1024 ;;
+ esac
+}
+
+calc_mid_capacity()
+{
+ dt_cpus=$(ls /sys/firmware/devicetree/base/cpus | grep "cpu(a)[0-9].*")
+ min_capacity=$((0xffffffff))
+ max_capacity=0
+ sched_capacity_shift=10
+
+ for dt_cpu in $dt_cpus; do
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency ]; then
+ log_skip "no clock frequency file present"
+ return
+ fi
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible ]; then
+ log_skip "no compatible file present"
+ return
+ fi
+ filename=/sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency
+ bytes=$(od -t u1 -A n $filename)
+ calc_freq $bytes
+ cpu_type=$(cat /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible)
+ set_eff $cpu_type
+ capacity=$((($freq>>20)*$eff))
+ if [ $capacity -gt $max_capacity ]; then
+ max_capacity=$capacity
+ fi
+ if [ $capacity -lt $min_capacity ]; then
+ min_capacity=$capacity
+ fi
+ if [ $(((4 * $max_capacity))) -lt $(((3 * ($max_capacity + $min_capacity)))) ]; then
+ middle_capacity=$((($min_capacity + $max_capacity)>>($sched_capacity_shift+1)))
+ else
+ middle_capacity=$(((($max_capacity / 3)>>($sched_capacity_shift-1))+1))
+ fi
+ done
+}
+
+cpu_num=0
+
+verify_cpu_capacity()
+{
+ for dt_cpu in $dt_cpus; do
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency ]; then
+ log_skip "no clock frequency file present"
+ return
+ fi
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible ]; then
+ log_skip "no compatible file present"
+ return
+ fi
+ filename=/sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency
+ bytes=$(od -t u1 -A n $filename)
+ calc_freq $bytes
+ cpu_type=$(cat /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible)
+ set_eff $cpu_type
+ capacity=$((($freq>>20)*$eff/$middle_capacity))
+ expected_capacity_string=$(dmesg | grep "CPU$cpu_num: update cpu_capacity")
+ expected_capacity=${expected_capacity_string##*cpu_capacity}
+ echo "cpu num: $cpu_num capacity $capacity expected capacity $expected_capacity"
+ check "expected capacity for cpu$cpu_num equal to computed capacity" "test $expected_capacity -eq $capacity"
+
+ cpu_num=$((cpu_num+1))
+ done
+}
+
+verify_capacity()
+{
+ if ! [ -d /sys/firmware/devicetree/base/cpus ]; then
+ log_skip "no cpus directory present"
+ return
+ fi
+
+ calc_mid_capacity
+ dt_cpus=$(ls -1 /sys/firmware/devicetree/base/cpus | egrep "cpu@.{1,2}$")
+ verify_cpu_capacity
+ dt_cpus=$(ls -1 /sys/firmware/devicetree/base/cpus | egrep "cpu@.{3,4}$")
+ verify_cpu_capacity
+}
+
+verify_capacity || exit 1
+test_status_show
diff --git a/cputopology/cputopology_04.txt b/cputopology/cputopology_04.txt
new file mode 100644
index 0000000..36647db
--- /dev/null
+++ b/cputopology/cputopology_04.txt
@@ -0,0 +1 @@
+test capacity calculation
--
1.8.3.2
****************
Team Work Logged
****************
# tyler-baker Progress #
* LAVA-1429 - Dispatcher Refactoring
* LAVA-1643 - 4. Trending Builds Boots and Tests (32.0%)
* Moved most kernelci.org projects to github. Merged testing branch to master, and retested functionality. Added cpufreq stress test and started to refactor the templates to use modules and kselftests.
* LAVA-1511 - Upstream Kernel CI
* LAVA-1524 - ARM KVM boot testing (52.0%)
* Basic support has been pushed for VMGroups based boot testing. Currently only Mustang is supported, however Juno should be exactly the same. Need to fix a bug in the report script before this is placed into production. After the ARM64 KVM boots are happening, I'll focus on upstreaming kconfig fragments for ARMv7 based KVM platforms.
* Fixed VMGroups reporting issue, and pushed the changes into the production CI loop.
Upstream KVM boot results can be found here:
http://kernelci.org/boot/?arm64&kvm
* LAVA-1511 - Upstream Kernel CI
* LAVA-1973 - Upstream kselftest fixes (16.0%)
* Reviewed by Kevin, added some cleanups to get ready for submission. Patches posted, awaiting replies/reviews.
# stylesen Progress #
* LAVA-1429 - Dispatcher Refactoring
* LAVA-1933 - Connect remote slaves to playground (100.0%)
* Fixing rough edges to get connected.
# gesha Progress #
* LAVA-1317 - lava-dispatcher maintenance
* LAVA-1381 - LC: Simple Loops within LAVA jobs (100.0%)
* Functional test job definition https://review.linaro.org/5306
# stevan.radakovic Progress #
* LAVA-1429 - Dispatcher Refactoring
* LAVA-1929 - Export a set of variables on the DUT (100.0%)
* Add logic for pulling environment variables for device from /etc/lava-server/env.dut.yaml
* Passing the enviromnent varibles from master to slave.
* Resolved issues pointed out in code review.
* Looking into problem with logging error stacktraces.
* Writing unit tests.
# neil.williams(a)linaro.org Progress #
* LAVA-1429 - Dispatcher Refactoring
* LAVA-1961 - Implement Multinode scheduling for pipeline jobs (100.0%)
# milo Progress #
* LAVA-1511 - Upstream Kernel CI
* LAVA-1920 - Backend improvements (12.5%)
* Started incorporating Kevin's build log parser to extract build log error and warning lines into their own files.
* LAVA-1511 - Upstream Kernel CI
* LAVA-1554 - Email notification system (87.5%)
* Continued work on multi-part email: refactored logic to create TXT based email and used a template also for that. Completed stub template for HTML email.
* Completed boot multipart email report, started work on new build email report.
* Completed build and boot HTML email reports. TXT and HTML reports are now template based.
* Added links to the frontend for the HTML build email report on the defconfig value; added links to the build log on errors/warnings count.
****************
Team In-Progress
****************
# dean.arnold(a)linaro.org Plan #
* LAVA-1963 - Review new dispatcher documentation
* LAVA-1967 - review development documentation
# georgy.redkozubov(a)linaro.org Plan #
* LAVA-1777 - Create lava-test-shell helpers for performance collection
# milo.casagrande(a)linaro.org Plan #
* LAVA-1920 - Backend improvements
* LAVA-1554 - Email notification system
* LAVA-1944 - Create multi-part email
* LAVA-1972 - Add links to frontend and storage
* LAVA-1971 - Parse build logs and store the results
# neil.williams(a)linaro.org Plan #
* LAVA-1961 - Implement Multinode scheduling for pipeline jobs
* LAVA-1436 - YAML description display support
# senthil.kumaran(a)linaro.org Plan #
* LAVA-1928 - Add timing to YAML logs
* LAVA-1933 - Connect remote slaves to playground
# stevan.radakovic(a)linaro.org Plan #
* LAVA-1394 - DF: LAVA server integration
* LAVA-1929 - Export a set of variables on the DUT
* LAVA-1831 - Add the ability to add/modify/remove meta-data for existing bundles
* LAVA-1968 - List alias or if no alias the test name in the tooltip
# tyler.baker(a)linaro.org Plan #
* LAVA-1792 - Tyler's Mentoring
* LAVA-1755 - ST boards support
* LAVA-1524 - ARM KVM boot testing
* LAVA-1643 - 4. Trending Builds Boots and Tests
Add test which verifies capacity calculation on arm
architecture platforms.
Since there isn't yet a similar calculation done
for arm64 platforms, this architecture isn't supported
by this test (at least as of now).
Signed-off-by: Larry Bassel <larry.bassel(a)linaro.org>
---
cputopology/cputopology_04.sh | 137 +++++++++++++++++++++++++++++++++++++++++
cputopology/cputopology_04.txt | 1 +
2 files changed, 138 insertions(+)
create mode 100755 cputopology/cputopology_04.sh
create mode 100644 cputopology/cputopology_04.txt
diff --git a/cputopology/cputopology_04.sh b/cputopology/cputopology_04.sh
new file mode 100755
index 0000000..26f611c
--- /dev/null
+++ b/cputopology/cputopology_04.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2015, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributors:
+# Larry Bassel <larry.bassel(a)linaro.org>
+#
+
+# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/P…
+
+source ../include/functions.sh
+
+calc_freq()
+{
+ byte1=$1
+ byte2=$2
+ byte3=$3
+ byte4=$4
+ freq=$((byte1*0x1000000+byte2*0x10000+byte3*0x100+byte4))
+}
+
+set_eff() {
+ type=$1
+
+ case $type in
+ arm,cortex-a15) eff=3891 ;;
+ arm,cortex-a7) eff=2048 ;;
+ * ) eff=1024 ;;
+ esac
+}
+
+calc_mid_capacity()
+{
+ dt_cpus=$(ls /sys/firmware/devicetree/base/cpus | grep "cpu(a)[0-9].*")
+ min_capacity=$((0xffffffff))
+ max_capacity=0
+ sched_capacity_shift=10
+
+ for dt_cpu in $dt_cpus; do
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency ]; then
+ log_skip "no clock frequency file present"
+ return
+ fi
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible ]; then
+ log_skip "no compatible file present"
+ return
+ fi
+ filename=/sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency
+ echo "clock frequency file: $filename"
+ bytes=$(od -t u1 -A n $filename)
+ calc_freq $bytes
+ echo "clock frequency: $freq"
+ cpu_type=$(cat /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible)
+ echo "cpu type: $cpu_type"
+ set_eff $cpu_type
+ echo "efficiency: $eff"
+ capacity=$((($freq>>20)*$eff))
+ echo "capacity: $capacity"
+ if [ $capacity -gt $max_capacity ]; then
+ max_capacity=$capacity
+ fi
+ if [ $capacity -lt $min_capacity ]; then
+ min_capacity=$capacity
+ fi
+ if [ $(((4 * $max_capacity))) -lt $(((3 * ($max_capacity + $min_capacity)))) ]; then
+ middle_capacity=$((($min_capacity + $max_capacity)>>($sched_capacity_shift+1)))
+ else
+ middle_capacity=$(((($max_capacity / 3)>>($sched_capacity_shift-1))+1))
+ fi
+ echo "min capacity: $min_capacity max: $max_capacity middle: $middle_capacity"
+ done
+}
+
+cpu_num=0
+
+verify_cpu_capacity()
+{
+ for dt_cpu in $dt_cpus; do
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency ]; then
+ log_skip "no clock frequency file present"
+ return
+ fi
+ if [ ! -f /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible ]; then
+ log_skip "no compatible file present"
+ return
+ fi
+ filename=/sys/firmware/devicetree/base/cpus/$dt_cpu/clock-frequency
+ echo "clock frequency file: $filename"
+ bytes=$(od -t u1 -A n $filename)
+ calc_freq $bytes
+ echo "frequency: $freq"
+ cpu_type=$(cat /sys/firmware/devicetree/base/cpus/$dt_cpu/compatible)
+ echo "cpu type: $cpu_type"
+ set_eff $cpu_type
+ echo "efficiency: $eff"
+ capacity=$((($freq>>20)*$eff/$middle_capacity))
+ expected_capacity_string=$(dmesg | grep "CPU$cpu_num: update cpu_capacity")
+ expected_capacity=${expected_capacity_string##*cpu_capacity}
+ echo "cpu num: $cpu_num capacity $capacity expected capacity $expected_capacity"
+ check "expected capacity for cpu$cpu_num equal to computed capacity" "test $expected_capacity -eq $capacity"
+
+ cpu_num=$((cpu_num+1))
+ done
+}
+
+verify_capacity()
+{
+ if ! [ -d /sys/firmware/devicetree/base/cpus ]; then
+ log_skip "no cpus directory present"
+ return
+ fi
+
+ calc_mid_capacity
+ dt_cpus=$(ls -1 /sys/firmware/devicetree/base/cpus | egrep "cpu@.{1,2}$")
+ verify_cpu_capacity
+ dt_cpus=$(ls -1 /sys/firmware/devicetree/base/cpus | egrep "cpu@.{3,4}$")
+ verify_cpu_capacity
+}
+
+verify_capacity || exit 1
+test_status_show
diff --git a/cputopology/cputopology_04.txt b/cputopology/cputopology_04.txt
new file mode 100644
index 0000000..36647db
--- /dev/null
+++ b/cputopology/cputopology_04.txt
@@ -0,0 +1 @@
+test capacity calculation
--
1.8.3.2
Add test which checks and prints scheduler domain flags.
Signed-off-by: Larry Bassel <larry.bassel(a)linaro.org>
---
cputopology/cputopology_03.sh | 109 +++++++++++++++++++++++++++++++++++++++++
cputopology/cputopology_03.txt | 1 +
2 files changed, 110 insertions(+)
create mode 100755 cputopology/cputopology_03.sh
create mode 100644 cputopology/cputopology_03.txt
diff --git a/cputopology/cputopology_03.sh b/cputopology/cputopology_03.sh
new file mode 100755
index 0000000..bfff5de
--- /dev/null
+++ b/cputopology/cputopology_03.sh
@@ -0,0 +1,109 @@
+#!/bin/sh
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2015, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributors:
+# Larry Bassel <larry.bassel(a)linaro.org>
+#
+
+# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/P…
+
+. ../include/functions.sh
+
+is_flag_set() {
+ flag=$1
+ mask=$2
+ message=$3
+
+ value=$(( $flag & $mask ))
+
+ if [ $value -ne 0 ]; then
+ echo "$message set"
+ else
+ echo "$message not set"
+ fi
+}
+
+are_flags_set() {
+ val=$1
+ domain_num=$2
+
+ # flag value, flag description
+ set -- 0x80 "domain$domain_num share cpu capacity flag" 0x100 "domain$domain_num share power domain flag" 0x200 "domain$domain_num share cpu package resources flag"
+
+ if [ $(($# % 2)) -ne 0 ]; then
+ echo "WARNING: malformed flag value, description in test"
+ fi
+
+ nflags=$(($# / 2))
+ i=1
+
+ while [ $i -le $nflags ] ; do
+ flagval=$((2*i-1))
+ eval "var1=\${$flagval}"
+ flagstr=$((2*i))
+ eval "var2=\${$flagstr}"
+ is_flag_set $val "$var1" "$var2"
+ i=$(( i + 1))
+ done
+}
+
+check_sched_domain_flags() {
+
+ cpu_num=$1
+ domain_num=$2
+
+ sched_domain_flags=/proc/sys/kernel/sched_domain/$cpu_num/domain$domain_num/flags
+ val=$(cat $sched_domain_flags)
+
+ check "sched_domain_flags (domain $domain_num)" "test \"$val\" != \"-1\""
+ printf "domain$domain_num flag 0x%x\n" $val
+
+ mask=$((0x7fff))
+ unexpected_bits=$((val & ~mask))
+
+ if [ $unexpected_bits -ne 0 ]; then
+ printf "NOTE: unexpected flag bits 0x%x set\n" $unexpected_bits
+ fi
+
+ are_flags_set $val $domain_num
+}
+
+check_all_sched_domain_flags() {
+
+ sched_domain_0_path=/proc/sys/kernel/sched_domain/cpu0
+
+ if [ ! -d $sched_domain_0_path ]; then
+ log_skip "no sched_domain directory present"
+ return
+ fi
+
+ n=0
+
+ sched_domain_flags_path=/proc/sys/kernel/sched_domain/$1/domain0/flags
+
+ while [ -e $sched_domain_flags_path ]; do
+ check_sched_domain_flags $1 $n
+ n=$(( n + 1))
+ sched_domain_flags_path=/proc/sys/kernel/sched_domain/$1/domain$n/flags
+ done
+}
+
+for_each_cpu check_all_sched_domain_flags 1 || exit 1
+test_status_show
diff --git a/cputopology/cputopology_03.txt b/cputopology/cputopology_03.txt
new file mode 100644
index 0000000..e43de69
--- /dev/null
+++ b/cputopology/cputopology_03.txt
@@ -0,0 +1 @@
+test that the sched_domain files are present and show the topology related flags
--
1.9.1