1#! /bin/sh 2# 3# Copyright (c) International Business Machines Corp., 2001 4# Author: Nageswara R Sastry <nasastry@in.ibm.com> 5# 6# This program is free software; you can redistribute it and#or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, but 12# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program; if not, write to the Free Software Foundation, 18# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19# 20 21export TCID="Power_Management_exclusive03" 22export TST_TOTAL=2 23 24. test.sh 25. pm_include.sh 26 27# Checking test environment 28check_arch 29 30max_sched_mc=2 31max_sched_smt=2 32 33tst_require_cmds python3 34 35hyper_threaded=$(is_hyper_threaded) 36multi_socket=$(is_multi_socket) 37multi_core=$(is_multi_core) 38if [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \ 39 $hyper_threaded -ne 0 ]; then 40 tst_brkm TCONF "System is not a multi socket & multi core" \ 41 "& hyper-threaded" 42fi 43 44# Verify threads consolidation stops when sched_mc &(/) sched_smt 45# is disabled. 46# Vary sched_mc from 1/2 to 0 when workload is running and 47# ensure that tasks do not consolidate to single package when 48# sched_mc is set to 0. 49RC=0 50for sched_mc in `seq 1 $max_sched_mc`; do 51 if pm_cpu_consolidation.py -v -c $sched_mc; then 52 echo "Test PASS: CPU consolidation test by varying" \ 53 "sched_mc $sched_mc to 0" 54 else 55 RC=1 56 echo "Test FAIL: CPU consolidation test by varying" \ 57 "sched_mc $sched_mc to 0" 58 fi 59done 60if [ $RC -eq 0 ]; then 61 tst_resm TPASS "CPU consolidation test by varying sched_mc" 62else 63 tst_resm TFAIL "CPU consolidation test by varying sched_mc" 64fi 65 66# Vary sched_mc & sched_smt from 1 to 0 & 2 to 0 when workload 67# is running and ensure that tasks do not consolidate to single 68# package when sched_mc is set to 0. 69RC=0 70for sched_mc in `seq 1 $max_sched_mc`; do 71 for sched_smt in `seq 1 $max_sched_smt`; do 72 if [ $sched_smt -eq $sched_mc ]; then 73 if pm_cpu_consolidation.py -v -c $sched_mc \ 74 -t $sched_smt; then 75 echo "Test PASS: CPU consolidation test by" \ 76 "varying sched_mc & sched_smt from" \ 77 "$sched_mc to 0" 78 else 79 RC=1 80 echo "Test FAIL: CPU consolidation test by" \ 81 "varying sched_mc & sched_smt from" \ 82 "$sched_mc to 0" 83 fi 84 fi 85 done 86done 87if [ $RC -eq 0 ]; then 88 tst_resm TPASS "CPU consolidation test by varying" \ 89 "sched_mc & sched_smt" 90else 91 tst_resm TFAIL "CPU consolidation test by varying" \ 92 "sched_mc & sched_smt" 93fi 94 95tst_exit 96