Home | History | Annotate | Download | only in power_management
      1 #! /bin/sh
      2 #
      3 # Copyright (c) International Business Machines  Corp., 2001
      4 # Author: Nageswara R Sastry <nasastry (at] 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 
     21 export TCID="Power_Management_exclusive03"
     22 export TST_TOTAL=2
     23 
     24 . test.sh
     25 . pm_include.sh
     26 
     27 # Checking test environment
     28 check_kervel_arch
     29 
     30 if tst_kvcmp -gt "2.6.29"; then
     31 	max_sched_mc=2
     32 	max_sched_smt=2
     33 else
     34 	max_sched_mc=1
     35 	max_sched_smt=1
     36 fi
     37 
     38 tst_check_cmds python
     39 
     40 hyper_threaded=$(is_hyper_threaded)
     41 multi_socket=$(is_multi_socket)
     42 multi_core=$(is_multi_core)
     43 if [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \
     44 	$hyper_threaded -ne 0 ]; then
     45 	tst_brkm TCONF "System is not a multi socket & multi core" \
     46 		"& hyper-threaded"
     47 fi
     48 
     49 # Verify threads consolidation stops when sched_mc &(/) sched_smt
     50 # is disabled.
     51 # Vary sched_mc from 1/2 to 0 when workload is running and
     52 # ensure that tasks do not consolidate to single package when
     53 # sched_mc is set to 0.
     54 RC=0
     55 for sched_mc in `seq 1  $max_sched_mc`; do
     56 	if pm_cpu_consolidation.py -v -c $sched_mc; then
     57 		echo "Test PASS: CPU consolidation test by varying" \
     58 			"sched_mc $sched_mc to 0"
     59 	else
     60 		RC=1
     61 		echo "Test FAIL: CPU consolidation test by varying" \
     62 			"sched_mc $sched_mc to 0"
     63 	fi
     64 done
     65 if [ $RC -eq 0 ]; then
     66 	tst_resm TPASS "CPU consolidation test by varying sched_mc"
     67 else
     68 	tst_resm TFAIL "CPU consolidation test by varying sched_mc"
     69 fi
     70 
     71 # Vary sched_mc & sched_smt from 1 to 0 & 2 to 0 when workload
     72 # is running and ensure that tasks do not consolidate to single
     73 # package when sched_mc is set to 0.
     74 RC=0
     75 for sched_mc in `seq 1  $max_sched_mc`; do
     76 	for sched_smt in `seq 1  $max_sched_smt`; do
     77 		if [ $sched_smt -eq $sched_mc ]; then
     78 			if pm_cpu_consolidation.py -v -c $sched_mc \
     79 				-t $sched_smt; then
     80 				echo "Test PASS: CPU consolidation test by" \
     81 					"varying sched_mc & sched_smt from" \
     82 					"$sched_mc to 0"
     83 			else
     84 				RC=1
     85 				echo "Test FAIL: CPU consolidation test by" \
     86 					"varying sched_mc & sched_smt from" \
     87 					"$sched_mc to 0"
     88 			fi
     89 		fi
     90 	done
     91 done
     92 if [ $RC -eq 0 ]; then
     93 	tst_resm TPASS "CPU consolidation test by varying" \
     94 		"sched_mc & sched_smt"
     95 else
     96 	tst_resm TFAIL "CPU consolidation test by varying" \
     97 		"sched_mc & sched_smt"
     98 fi
     99 
    100 tst_exit
    101