1*49cdfc7eSAndroid Build Coastguard Worker#! /bin/sh 2*49cdfc7eSAndroid Build Coastguard Worker# 3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) International Business Machines Corp., 2001 4*49cdfc7eSAndroid Build Coastguard Worker# Author: Nageswara R Sastry <[email protected]> 5*49cdfc7eSAndroid Build Coastguard Worker# 6*49cdfc7eSAndroid Build Coastguard Worker# This program is free software; you can redistribute it and#or modify 7*49cdfc7eSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 8*49cdfc7eSAndroid Build Coastguard Worker# the Free Software Foundation; either version 2 of the License, or 9*49cdfc7eSAndroid Build Coastguard Worker# (at your option) any later version. 10*49cdfc7eSAndroid Build Coastguard Worker# 11*49cdfc7eSAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful, but 12*49cdfc7eSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13*49cdfc7eSAndroid Build Coastguard Worker# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14*49cdfc7eSAndroid Build Coastguard Worker# for more details. 15*49cdfc7eSAndroid Build Coastguard Worker# 16*49cdfc7eSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 17*49cdfc7eSAndroid Build Coastguard Worker# along with this program; if not, write to the Free Software Foundation, 18*49cdfc7eSAndroid Build Coastguard Worker# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19*49cdfc7eSAndroid Build Coastguard Worker# 20*49cdfc7eSAndroid Build Coastguard Worker 21*49cdfc7eSAndroid Build Coastguard Workerexport TCID="Power_Management05" 22*49cdfc7eSAndroid Build Coastguard Workerexport TST_TOTAL=2 23*49cdfc7eSAndroid Build Coastguard Worker 24*49cdfc7eSAndroid Build Coastguard Worker. test.sh 25*49cdfc7eSAndroid Build Coastguard Worker. pm_include.sh 26*49cdfc7eSAndroid Build Coastguard Worker 27*49cdfc7eSAndroid Build Coastguard Worker# Checking test environment 28*49cdfc7eSAndroid Build Coastguard Workercheck_arch 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Workermax_sched_mc=2 31*49cdfc7eSAndroid Build Coastguard Workermax_sched_smt=2 32*49cdfc7eSAndroid Build Coastguard Worker 33*49cdfc7eSAndroid Build Coastguard Workertst_require_cmds python3 34*49cdfc7eSAndroid Build Coastguard Worker 35*49cdfc7eSAndroid Build Coastguard Workerif ! grep sched_debug -qw /proc/cmdline ; then 36*49cdfc7eSAndroid Build Coastguard Worker tst_brkm TCONF "Kernel cmdline parameter 'sched_debug' needed," \ 37*49cdfc7eSAndroid Build Coastguard Worker "CPU Consolidation test cannot run" 38*49cdfc7eSAndroid Build Coastguard Workerfi 39*49cdfc7eSAndroid Build Coastguard Worker 40*49cdfc7eSAndroid Build Coastguard Workerhyper_threaded=$(is_hyper_threaded) 41*49cdfc7eSAndroid Build Coastguard Workerif [ ! -f /sys/devices/system/cpu/sched_mc_power_savings \ 42*49cdfc7eSAndroid Build Coastguard Worker -o $hyper_threaded -ne 0 ] ; then 43*49cdfc7eSAndroid Build Coastguard Worker tst_brkm TCONF "Required kernel configuration for SCHED_MC" \ 44*49cdfc7eSAndroid Build Coastguard Worker "NOT set, or sched_mc_power_savings interface in system" \ 45*49cdfc7eSAndroid Build Coastguard Worker "which is not hyper-threaded" 46*49cdfc7eSAndroid Build Coastguard Workerfi 47*49cdfc7eSAndroid Build Coastguard Worker 48*49cdfc7eSAndroid Build Coastguard Worker# sched_domain test 49*49cdfc7eSAndroid Build Coastguard Workerecho "max sched mc $max_sched_mc" 50*49cdfc7eSAndroid Build Coastguard WorkerRC=0 51*49cdfc7eSAndroid Build Coastguard Workerfor sched_mc in `seq 0 $max_sched_mc`; do 52*49cdfc7eSAndroid Build Coastguard Worker pm_sched_domain.py -c $sched_mc; ret=$? 53*49cdfc7eSAndroid Build Coastguard Worker analyze_sched_domain_result $sched_mc $ret; RC=$? 54*49cdfc7eSAndroid Build Coastguard Workerdone 55*49cdfc7eSAndroid Build Coastguard Workerif [ $RC -eq 0 ]; then 56*49cdfc7eSAndroid Build Coastguard Worker tst_resm TPASS "Sched_domain test for sched_mc" 57*49cdfc7eSAndroid Build Coastguard Workerelse 58*49cdfc7eSAndroid Build Coastguard Worker tst_resm TFAIL "Sched_domain test for sched_mc" 59*49cdfc7eSAndroid Build Coastguard Workerfi 60*49cdfc7eSAndroid Build Coastguard Worker 61*49cdfc7eSAndroid Build Coastguard Worker# Testcase to validate sched_domain tree 62*49cdfc7eSAndroid Build Coastguard WorkerRC=0 63*49cdfc7eSAndroid Build Coastguard Workerfor sched_mc in `seq 0 $max_sched_mc`; do 64*49cdfc7eSAndroid Build Coastguard Worker pm_get_sched_values sched_smt; max_sched_smt=$? 65*49cdfc7eSAndroid Build Coastguard Worker for sched_smt in `seq 0 $max_sched_smt`; do 66*49cdfc7eSAndroid Build Coastguard Worker pm_sched_domain.py -c $sched_mc -t $sched_smt; ret=$? 67*49cdfc7eSAndroid Build Coastguard Worker analyze_sched_domain_result $sched_mc $ret $sched_smt; RC=$? 68*49cdfc7eSAndroid Build Coastguard Worker done 69*49cdfc7eSAndroid Build Coastguard Workerdone 70*49cdfc7eSAndroid Build Coastguard Workerif [ $RC -eq 0 ]; then 71*49cdfc7eSAndroid Build Coastguard Worker tst_resm TPASS "Sched_domain test for sched_mc & sched_smt" 72*49cdfc7eSAndroid Build Coastguard Workerelse 73*49cdfc7eSAndroid Build Coastguard Worker tst_resm TFAIL "Sched_domain test for sched_mc & sched_smt" 74*49cdfc7eSAndroid Build Coastguard Workerfi 75*49cdfc7eSAndroid Build Coastguard Worker 76*49cdfc7eSAndroid Build Coastguard Workertst_exit 77