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_kervel_arch 29 30tst_kvercmp 2 6 29; rc=$? 31if [ $rc -eq 2 ] ; then 32 max_sched_mc=2 33 max_sched_smt=2 34else 35 max_sched_mc=1 36 max_sched_smt=1 37fi 38 39tst_check_cmds python 40 41hyper_threaded=$(is_hyper_threaded) 42multi_socket=$(is_multi_socket) 43multi_core=$(is_multi_core) 44if [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \ 45 $hyper_threaded -ne 0 ]; then 46 tst_brkm TCONF "System is not a multi socket & multi core" \ 47 "& hyper-threaded" 48fi 49 50# Verify threads consolidation stops when sched_mc &(/) sched_smt 51# is disabled. 52# Vary sched_mc from 1/2 to 0 when workload is running and 53# ensure that tasks do not consolidate to single package when 54# sched_mc is set to 0. 55RC=0 56for sched_mc in `seq 1 $max_sched_mc`; do 57 if pm_cpu_consolidation.py -v -c $sched_mc; then 58 echo "Test PASS: CPU consolidation test by varying" \ 59 "sched_mc $sched_mc to 0" 60 else 61 RC=1 62 echo "Test FAIL: CPU consolidation test by varying" \ 63 "sched_mc $sched_mc to 0" 64 fi 65done 66if [ $RC -eq 0 ]; then 67 tst_resm TPASS "CPU consolidation test by varying sched_mc" 68else 69 tst_resm TFAIL "CPU consolidation test by varying sched_mc" 70fi 71 72# Vary sched_mc & sched_smt from 1 to 0 & 2 to 0 when workload 73# is running and ensure that tasks do not consolidate to single 74# package when sched_mc is set to 0. 75RC=0 76for sched_mc in `seq 1 $max_sched_mc`; do 77 for sched_smt in `seq 1 $max_sched_smt`; do 78 if [ $sched_smt -eq $sched_mc ]; then 79 if pm_cpu_consolidation.py -v -c $sched_mc \ 80 -t $sched_smt; then 81 echo "Test PASS: CPU consolidation test by" \ 82 "varying sched_mc & sched_smt from" \ 83 "$sched_mc to 0" 84 else 85 RC=1 86 echo "Test FAIL: CPU consolidation test by" \ 87 "varying sched_mc & sched_smt from" \ 88 "$sched_mc to 0" 89 fi 90 fi 91 done 92done 93if [ $RC -eq 0 ]; then 94 tst_resm TPASS "CPU consolidation test by varying" \ 95 "sched_mc & sched_smt" 96else 97 tst_resm TFAIL "CPU consolidation test by varying" \ 98 "sched_mc & sched_smt" 99fi 100 101tst_exit 102