Master script modified to enable testcases to run on Power
PATCH 1/4 Master script modified to enable testcases to run on Power
Patch to enable Power management testcases in LTP to run on Power platform
testcases/kernel/power_management/runpwtests.sh +53 -52
@@ -28,10 +28,21 @@ # History: 26 Aug 2008 - Created this file # 03 Nov 2008 - Added CPUIDLE sysfs testcase # +# Function: main +# +# Description: - Execute all tests, exit with test status. +# +# Exit: - zero on success +# - non-zero on failure. +# + +#List of reusable functions defined in pm_include.sh +. ./pm_include.sh + +RC=0 #Return status # Exporting Required variables export TST_TOTAL=1 -#LTPTMP=${TMP} export PATH=${PATH}:. export TCID="Power_Management" export TST_COUNT=0
@@ -40,48 +51,39 @@ export analysis="/proctstat" YES=0 NO=1 -#List of reusable functions defined in pm_include.sh -. ./pm_include.sh - -# Function: main -# -# Description: - Execute all tests, exit with test status. -# -# Exit: - zero on success -# - non-zero on failure. -# -RC=0 #Return status # Checking required kernel version and architecture tst_kvercmp 2 6 21; rc=$? if [ $rc -ne 1 -a $rc -ne 2 ] ; then - tst_resm TCONF "Kernel version not supported; not running testcases" - exit 0 + tst_resm TCONF "Kernel version not supported; not running testcases" + exit 0 else - case "$(uname -m)" in - i[4-6]86|x86_64) + case "$(uname -m)" in + i[4-6]86|x86_64) + ;; + powerpc|ppc|powerpc64|ppc64) ;; - *) - tst_resm TCONF "Arch not supported; not running testcases" - exit 0 - ;; - esac + *) + tst_resm TCONF "Arch not supported; not running testcases" + exit 0 + ;; + esac fi tst_kvercmp 2 6 29; rc=$? if [ $rc -eq 2 ] ; then - max_sched_mc=2 - max_sched_smt=2 + max_sched_mc=2 + max_sched_smt=2 else - max_sched_mc=1 - max_sched_smt=1 + max_sched_mc=1 + max_sched_smt=1 fi tst_kvercmp 2 6 31; rc=$? if [ $rc -eq 1 -o $rc -eq 2 ] ; then - timer_migr_support_compatible=1 + timer_migr_support_compatible=0 else - timer_migr_support_compatible=0 + timer_migr_support_compatible=1 fi is_hyper_threaded; hyper_threaded=$?
@@ -90,7 +92,6 @@ is_multi_core; multi_core=$? is_dual_core; dual_core=$? #Checking sched_mc sysfs interface -#check_config.sh config_sched_mc || RC=$? TST_COUNT=1 if [ $multi_socket -eq $YES -a $multi_core -eq $YES ] ; then if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then
@@ -103,6 +104,25 @@ if [ $multi_socket -eq $YES -a $multi_co else tst_resm TCONF "Required kernel configuration for SCHED_MC NOT set" fi + + : $(( TST_COUNT+=1)) + if [ -f /proc/sys/kernel/timer_migration ]; then + if [ $timer_migr_support_compatible -eq $YES ]; then + if test_timer_migration.sh; then + tst_resm TPASS "Timer Migration interface test" + else + RC=$? + tst_resm TFAIL "Timer migration interface test" + fi + fi + else + if [ $supp -eq $YES ]; then + RC=$? + tst_resm TFAIL "Timer migration interface missing" + else + tst_resm TCONF "Kernel version does not support Timer migration" + fi + fi else if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then tst_resm TFAIL "sched_mc_power_savings interface in system which is not a multi socket &(/) multi core"
@@ -135,7 +155,6 @@ else fi # Checking cpufreq sysfs interface files -#check_config.sh config_cpu_freq || RC=$? : $(( TST_COUNT += 1 )) if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then if check_cpufreq_sysfs_files.sh; then
@@ -187,12 +206,13 @@ else fi # sched_domain test -if ! type python > /dev/null ; then +which python > /dev/null +if [ $? -ne 0 ] ; then tst_resm TCONF "Python is not installed, CPU Consoldation\ test cannot run" else if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then - echo "max sched mc $max_sched_mc" + get_sched_values sched_mc; max_sched_mc=$? for sched_mc in `seq 0 $max_sched_mc`; do : $(( TST_COUNT+=1)) sched_domain.py -c $sched_mc; RC=$?
@@ -210,25 +230,6 @@ else fi fi -: $(( TST_COUNT+=1)) -if [ -f /proc/sys/kernel/timer_migration ]; then - if [ $timer_migr_support_compatible -eq $YES ]; then - if test_timer_migration.sh; then - tst_resm TPASS "Timer Migration interface test" - else - RC=$? - tst_resm TFAIL "Timer migration interface test" - fi - fi -else - if [ $timer_migr_support_compatible -eq $YES ]; then - RC=$? - tst_resm TFAIL "Timer migration interface missing" - else - tst_resm TCONF "Kernel version does not support Timer migration" - fi -fi - if [ $# -gt 0 -a "$1" = "-exclusive" ]; then # Test CPU consolidation if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
@@ -266,7 +267,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; fi - if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES -a $multi_core -eq $NO ]; then + if [ $hyper_threaded -eq $YES ]; then #Testcase to validate consolidation at core level for sched_smt in `seq 0 $max_sched_smt`; do if [ $sched_smt -eq 2 ]; then
@@ -319,7 +320,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; fi # Verify threads consolidation stops when sched_smt is disabled in HT systems - if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES ]; then + if [ $hyper_threaded -eq $YES ]; then # Vary only sched_smt from 1 to 0 when workload is running and ensure that # tasks do not consolidate to single core when sched_smt is set to 0 : $(( TST_COUNT += 1 ))
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 2/4 Reusable functions modified to learn topology from sysfs
Patch to learn topology of system through sysfs.
testcases/kernel/power_management/pm_include.sh +45 -18
@@ -69,9 +69,24 @@ get_supporting_govr() { } is_hyper_threaded() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` - [ $siblings -gt $cpu_cores ]; return $? + entries=`cat /sys/devices/system/cpu/cpu0/topology/thread_siblings` + count=`echo $entries | awk -F"," '{ print NF }'` + cpucount=0 + for ((i=1;i<=$count;i++)) + do + + cpumask=`echo $entries | awk -v x=$i 'BEGIN{FS=","} {print $x}'` + while [ $cpumask -gt 0 ] + do + ((cpucount=cpucount+1)) + ((cpumask=$cpumask>>1)) + done + done + if [ $cpucount -gt 1 ]; then + return 0 + else + return 1 + fi } check_input() {
@@ -110,26 +125,38 @@ is_multi_socket() { [ $no_of_sockets -gt 1 ] ; return $? } +get_core_sibling_count() { + entries=`cat /sys/devices/system/cpu/cpu0/topology/core_siblings` + count=`echo $entries | awk -F"," '{ print NF }'` + cpucount=0 + for ((i=1;i<=$count;i++)) + do + cpumask=`echo $entries | awk -v x=$i 'BEGIN{FS=","} {print $x}'` + while [ $cpumask -gt 0 ] + do + ((cpucount=cpucount+1)) + ((cpumask=$cpumask>>1)) + done + done + echo $cpucount +} + is_multi_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` - if [ $siblings -eq $cpu_cores ]; then - [ $cpu_cores -gt 1 ]; return $? - else - : $(( num_of_cpus = siblings / cpu_cores )) - [ $num_of_cpus -gt 1 ]; return $? + sibling_cnt=$(get_core_sibling_count) + if [ $sibling_cnt -gt 1 ]; then + return 0 + else + return 1 fi } is_dual_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` - if [ $siblings -eq $cpu_cores ]; then - [ $cpu_cores -eq 2 ]; return $? - else - : $(( num_of_cpus = siblings / cpu_cores )) - [ $num_of_cpus -eq 2 ]; return $? - fi + sibling_cnt=$(get_core_sibling_count) + if [ $sibling_cnt -eq 2 ]; then + return 0 + else + return 1 + fi } get_kernel_version() {
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [Patch 2/4]Reusable functions modified to learn topology from sysfs
Quoted 21 lines · Poornima Nayak
Patch to learn topology of system through sysfs.
Signed-off-by poornima nayak <[email protected]>diff -uprN ltp-intermediate-20091209.orig/testcases/kernel/
power_management/pm_include.shltp-intermediate-20091209.fixes/testcases/kernel/power_management/pm_include.sh
--- ltp-intermediate-20091209.orig/testcases/kernel/power_management/pm_include.sh2009-12-09 13:18:25.000000000 +0530
+++ ltp-intermediate-20091209.fixes/testcases/kernel/power_management/pm_include.sh2009-12-24 23:17:37.798995821 +0530testcases/kernel/power_management/pm_include.sh +0
-1@@ -69,9 +69,24 @@ get_supporting_govr() { } is_hyper_threaded() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'`
- cpu_cores=`cat/proc/cpuinfo| grep "cpu cores" | uniq | cut -
f2 -d':'`(quoted diff) +1
-1- [ $siblings -gt $cpu_cores ]; return $? + entries=`cat /sys/devices/system/cpu/cpu0/topology/
Quoted 2 lines
thread_siblings`
+ count=echo $entries | awk -F"," '{ print NF }'
Why have an intermediate variable labeled entries if all you do is echo the value back out and run it through awk unquoted? You could just as easily do this instead:
awk [options] [script-body] /sys/devices/system/cpu/cpu0/topology/ thread_siblings
Quoted 78 lines
testcases/kernel/power_management/pm_include.sh +5
-0+ cpucount=0 + for ((i=1;i<=$count;i++)) + do + + cpumask=`echo $entries | awk -v x=$i 'BEGIN{FS=","} {print$x}'`
testcases/kernel/power_management/pm_include.sh +11
-0+ while [ $cpumask -gt 0 ] + do + ((cpucount=cpucount+1)) + ((cpumask=$cpumask>>1)) + done + done + if [ $cpucount -gt 1 ]; then + return 0 + else + return 1 + fi}
check_input(){testcases/kernel/power_management/pm_include.sh +7
-0@@ -110,26 +125,38 @@ is_multi_socket() { [ $no_of_sockets -gt 1 ] ; return $? } +get_core_sibling_count() { + entries=`cat /sys/devices/system/cpu/cpu0/topology/core_siblings` + count=`echo $entries | awk -F"," '{ print NF }'` + cpucount=0 + for ((i=1;i<=$count;i++)) + do + cpumask=`echo $entries | awk -v x=$i 'BEGIN{FS=","} {print$x}'`
testcases/kernel/power_management/pm_include.sh +9
-0+ while [ $cpumask -gt 0 ] + do + ((cpucount=cpucount+1)) + ((cpumask=$cpumask>>1)) + done + done + echo $cpucount +} +
is_multi_core(){
- siblings=`cat/proc/cpuinfo| grep siblings | uniq | cut -f2 -
d':'`
- cpu_cores=`cat/proc/cpuinfo| grep "cpu cores" | uniq | cut -
f2 -d':'`testcases/kernel/power_management/pm_include.sh +5
-5- if [ $siblings -eq $cpu_cores ]; then - [ $cpu_cores -gt 1 ]; return $? - else - : $(( num_of_cpus = siblings / cpu_cores )) - [ $num_of_cpus -gt 1 ]; return $? + sibling_cnt=$(get_core_sibling_count) + if [ $sibling_cnt -gt 1 ]; then + return 0 + else + return 1 fi}
is_dual_core(){
- siblings=`cat/proc/cpuinfo| grep siblings | uniq | cut -f2 -
d':'`
- cpu_cores=`cat/proc/cpuinfo| grep "cpu cores" | uniq |
cut -f2 -d':'`testcases/kernel/power_management/pm_include.sh +6
-6- if [ $siblings -eq $cpu_cores ]; then - [ $cpu_cores -eq 2 ]; return $? - else - : $(( num_of_cpus = siblings / cpu_cores )) - [ $num_of_cpus -eq 2 ]; return $? - fi + sibling_cnt=$(get_core_sibling_count) + if [ $sibling_cnt -eq 2 ]; then + return 0 + else + return 1 + fi}
Quoted 1 line
get_kernel_version(){
Thanks,
-Garrett
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [Patch 2/4]Reusable functions modified to learn topology from sysfs
In reply to Poornima NayakQuoted 44 lines · Poornima Nayak
Patch to learn topology of system through sysfs.
Signed-off-by poornima nayak <[email protected]>diff -uprN
ltp-intermediate-20091209.orig/testcases/kernel/power_management/pm_include.shltp-intermediate-20091209.fixes/testcases/kernel/power_management/pm_include.shtestcases/kernel/power_management/pm_include.sh +23
-3@@ -69,9 +69,24 @@ get_supporting_govr() { } is_hyper_threaded() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` - [ $siblings -gt $cpu_cores ]; return $? + entries=`cat /sys/devices/system/cpu/cpu0/topology/thread_siblings` + count=`echo $entries | awk -F"," '{ print NF }'` + cpucount=0 + for ((i=1;i<=$count;i++)) + do + + cpumask=`echo $entries | awk -v x=$i 'BEGIN{FS=","} {print $x}'` + while [ $cpumask -gt 0 ] + do + ((cpucount=cpucount+1)) + ((cpumask=$cpumask>>1)) + done + done + if [ $cpucount -gt 1 ]; then + return 0 + else + return 1 + fi } check_input() {@@ -110,26 +125,38 @@ is_multi_socket() { [ $no_of_sockets -gt 1 ] ; return $? } +get_core_sibling_count() { + entries=`cat /sys/devices/system/cpu/cpu0/topology/core_siblings` + count=`echo $entries | awk -F"," '{ print NF }'` + cpucount=0 + for ((i=1;i<=$count;i++))
testcases/kernel/power_management/pm_include.sh is_multi_socket() { · line 142
Quoted 10 lines
testcases/kernel/power_management/pm_include.sh +10
-0+ do + cpumask=`echo $entries | awk -v x=$i 'BEGIN{FS=","} {print $x}'` + while [ $cpumask -gt 0 ] + do + ((cpucount=cpucount+1)) + ((cpumask=$cpumask>>1)) + done + done + echo $cpucount +}
I find code duplication here.
Cant we have,
get_entity_count() {
ENTITY=$1
entries=`cat /sys/devices/system/cpu/cpu0/topology/$ENTITY_SIBLINGS`
.
.
.
.
.
echo $cpucount
}get_core_siblings_count() {
get_entity_count "core"
}
get_thread_siblings_count() {
get_entity_count "thread"
}
is_hyperthreaded() {
nr_threads = get_thread_siblings_count()
if [$nr_threads -gt 1 ]; then
return 0
else
return 1
fi
}
and so on ?
}
Quoted 35 lines
testcases/kernel/power_management/pm_include.sh +12
-15+ is_multi_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` - if [ $siblings -eq $cpu_cores ]; then - [ $cpu_cores -gt 1 ]; return $? - else - : $(( num_of_cpus = siblings / cpu_cores )) - [ $num_of_cpus -gt 1 ]; return $? + sibling_cnt=$(get_core_sibling_count) + if [ $sibling_cnt -gt 1 ]; then + return 0 + else + return 1 fi } is_dual_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` - if [ $siblings -eq $cpu_cores ]; then - [ $cpu_cores -eq 2 ]; return $? - else - : $(( num_of_cpus = siblings / cpu_cores )) - [ $num_of_cpus -eq 2 ]; return $? - fi + sibling_cnt=$(get_core_sibling_count) + if [ $sibling_cnt -eq 2 ]; then + return 0 + else + return 1 + fi } get_kernel_version() {
Signature · 13 lines
Thanks and Regards gautham ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 3/4 Python functions modified to run on Power platform
In reply to Poornima NayakPatch to learn topology information from sysfs. Incorporated Gautham's comments to improve maintainence of the code.
testcases/kernel/power_management/lib/sched_mc.py +81 -85
@@ -24,6 +24,12 @@ cpu2_max_intr = 0 intr_stat_timer_0 = [] siblings_list = [] +# Define thresholds for CPU consolidation +THRES_HT_KERNBENCH=40 +THRES_HT=40 +THRES_KERNBENCH=50 +THRES_EBIZZY=70 + def clear_dmesg(): ''' Clears dmesg
@@ -65,6 +71,42 @@ def count_num_sockets(): print "INFO: Failed to get number of sockets in system", details sys.exit(1) +def get_hyper_thread_count(): + ''' Return number of threads in cpu0 + ''' + try: + file_cpuinfo = open("/sys/devices/system/cpu/cpu0/topology/thread_siblings", 'r') + threads_count = 0 + for line in file_cpuinfo: + core_grps = line.split(",") + for i in range(0, len(core_grps)): + cpumask=int(core_grps[i]) + while cpumask > 0: + threads_count = threads_count + 1 + cpumask = cpumask >> 1 + return threads_count + except Exception, details: + print "INFO: Failed to get threaded siblings count", details + sys.exit(1) + +def get_core_sibling_count(): + ''' Return number of threads in cpu0 + ''' + try: + file_cpuinfo = open("/sys/devices/system/cpu/cpu0/topology/core_siblings", 'r') + cores_count = 0 + for line in file_cpuinfo: + core_grps = line.split(",") + for i in range(0, len(core_grps)): + cpumask=int(core_grps[i]) + while cpumask > 0: + cores_count = cores_count + 1 + cpumask = cpumask >> 1 + return cores_count + except Exception, details: + print "INFO: Failed to get core siblings count", details + sys.exit(1) + def is_multi_socket(): '''Return 1 if the system is multi socket else return 0 '''
@@ -81,15 +123,8 @@ def is_hyper_threaded(): '''Return 1 if the system is hyper threaded else return 0 ''' try: - file_cpuinfo = open("/proc/cpuinfo", 'r') - for line in file_cpuinfo: - if line.startswith('siblings'): - siblings = line.split(":") - if line.startswith('cpu cores'): - cpu_cores = line.split(":") - break - if int( siblings[1] ) / int( cpu_cores[1] )> 1: - file_cpuinfo.close() + threads_count = get_hyper_thread_count() + if threads_count > 1: return 1 else: return 0
@@ -98,53 +133,33 @@ def is_hyper_threaded(): sys.exit(1) def is_multi_core(): - ''' Return true if system has sockets has multiple cores + ''' Return true if system has sockets with multiple cores ''' try: - file_cpuinfo = open("/proc/cpuinfo", 'r') - for line in file_cpuinfo: - if line.startswith('siblings'): - siblings = line.split(":") - if line.startswith('cpu cores'): - cpu_cores = line.split(":") - break - - if int( siblings[1] ) == int( cpu_cores[1] ): - if int( cpu_cores[1] ) > 1: - multi_core = 1 - else: - multi_core = 0 + cores_count = get_core_sibling_count() + if cores_count > 1: + return 1 else: - num_of_cpus = int(siblings[1]) / int(cpu_cores[1]) - if num_of_cpus > 1: - multi_core = 1 - else: - multi_core = 0 - file_cpuinfo.close() - return multi_core + return 0 except Exception: print "Failed to check if system is multi core system" sys.exit(1) -def get_hyper_thread_count(): - ''' Return number of threads in CPU. For eg for x3950 this function - would return 2. In future if 4 threads are supported in CPU, this - routine would return 4 +def is_quad_core(): + ''' + Read sys topology info and check if system is Quad core ''' try: - file_cpuinfo = open("/proc/cpuinfo", 'r') - for line in file_cpuinfo: - if line.startswith('siblings'): - siblings = line.split(":") - if line.startswith('cpu cores'): - cpu_cores = line.split(":") - break - return( int( siblings[1] ) / int( cpu_cores[1] ) ) - except Exception: - print "Failed to check if system is hyper-threaded" + cpu_cores = get_core_sibling_count() + if cpu_cores == 4: + return(1) + else: + return(0) + except IOError, e: + print "Failed in function to check if system is quad core", e sys.exit(1) - + def map_cpuid_pkgid(): ''' Routine to map physical package id to cpu id '''
@@ -190,10 +205,21 @@ def generate_sibling_list(): try: for i in range(0, cpu_count): siblings_file = '/sys/devices/system/cpu/cpu%s' % i - siblings_file += '/topology/thread_siblings_list' - threads_sibs = open(siblings_file).read().rstrip() - thread_ids = threads_sibs.split("-") - + siblings_file += '/topology/thread_siblings' + threads_sibs = open(siblings_file).read().split(",") + thread_ids = [] + cpu_id=0 + mask=1 + + for j in range(len(threads_sibs)-1, 0, -1): + for k in range(0, 8): + mask_bit_set=mask & int(threads_sibs[j],16) + if mask_bit_set != 0: + if not cpu_id in thread_ids: + thread_ids.append(cpu_id) + mask = mask << 1 + cpu_id += 1 + if not thread_ids in siblings_list: siblings_list.append(thread_ids) except Exception, details:
@@ -211,7 +237,7 @@ def get_siblings(cpu_id): for j in siblings_list[i]: # Exclude cpu_id in the list of siblings if j != cpu_id: - cpus += j + cpus += str(j) return cpus return cpus except Exception, details:
@@ -276,17 +302,6 @@ def set_sched_smt_power(sched_smt_level) print "Could not set sched_smt_power_savings to", sched_smt_level, e sys.exit(1) -def set_timer_migration_interface(value): - ''' Set value of timer migration interface to a value - passed as argument - ''' - try: - os.system('echo %s > \ - /proc/sys/kernel/timer_migration 2>/dev/null' % value) - except OSError, e: - print "Could not set timer_migration to ", value, e - sys.exit(1) - def get_job_count(stress, workload, sched_smt): ''' Returns number of jobs/threads to be triggered '''
@@ -585,25 +600,6 @@ def expand_range(range_val): except Exception, details: print "INFO: expand_pkg_grps failed ", details -def is_quad_core(): - ''' - Read /proc/cpuinfo and check if system is Quad core - ''' - try: - cpuinfo = open('/proc/cpuinfo', 'r') - for line in cpuinfo: - if line.startswith('cpu cores'): - cores = line.split("cpu cores") - num_cores = cores[1].split(":") - cpuinfo.close() - if int(num_cores[1]) == 4: - return(1) - else: - return(0) - except IOError, e: - print "Failed to get cpu core information", e - sys.exit(1) - def validate_cpugrp_map(cpu_group, sched_mc_level, sched_smt_level): ''' Verify if cpugrp belong to same package
@@ -612,7 +608,7 @@ def validate_cpugrp_map(cpu_group, sched try: if is_hyper_threaded(): for pkg in sorted(cpu_map.keys()): - # if CPU utilized is across package this condition will be true + # if CPU utilized is across package this condition will be true if len(modi_cpu_grp) != len(cpu_group): break for core in sorted(cpu_map[pkg].keys()):
@@ -724,21 +720,21 @@ def validate_cpu_consolidation(stress, w utilization += int(get_cpu_utilization("cpu%s" %sib_list[i])) else: utilization = stats_percentage[l][1] - if utilization > 40: + if utilization > THRES_HT_KERNBENCH: cpus_utilized.append(int(cpu_id[1])) if siblings != "": for i in range(0, len(sib_list)): cpus_utilized.append(int(sib_list[i])) else: # This threshold wuld be modified based on results - if stats_percentage[l][1] > 40: + if stats_percentage[l][1] > THRES_HT: cpus_utilized.append(int(cpu_id[1])) else: if work_ld == "kernbench" : - if stats_percentage[l][1] > 50: + if stats_percentage[l][1] > THRES_KERNBENCH: cpus_utilized.append(int(cpu_id[1])) else: - if stats_percentage[l][1] > 70: + if stats_percentage[l][1] > THRES_EBIZZY: cpus_utilized.append(int(cpu_id[1])) cpus_utilized.sort() print "INFO: CPU's utilized ", cpus_utilized
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [Patch 3/4]Python functions modified to run on Power platform
Quoted 163 lines · Poornima Nayak
Patch to learn topology information from sysfs. Incorporated Gautham's comments to improve maintainence of the code.
Signed-off-by poornima nayak <[email protected]>diff -uprN ltp-intermediate-20091209.orig/testcases/kernel/
power_management/lib/sched_mc.pyltp-intermediate-20091209.fixes/testcases/kernel/power_management/lib/sched_mc.py
--- ltp-intermediate-20091209.orig/testcases/kernel/power_management/lib/sched_mc.py2009-12-09 13:18:25.000000000 +0530
+++ ltp-intermediate-20091209.fixes/testcases/kernel/power_management/lib/sched_mc.py2009-12-24 23:14:23.712098662
+0530(quoted diff) +0
-0@@ -24,6 +24,12 @@ cpu2_max_intr = 0
intr_stat_timer_0= []siblings_list= []testcases/kernel/power_management/lib/sched_mc.py +6
-0+# Define thresholds for CPU consolidation +THRES_HT_KERNBENCH=40 +THRES_HT=40 +THRES_KERNBENCH=50 +THRES_EBIZZY=70 +def
clear_dmesg():''' Clears dmesg(quoted diff) +0
-0@@ -65,6 +71,42 @@ def count_num_sockets(): print "INFO: Failed to get number of sockets in system",details
sys.exit(1)testcases/kernel/power_management/lib/sched_mc.py +5
-0+def get_hyper_thread_count(): + ''' Return number of threads in cpu0 + ''' + try: + file_cpuinfo = open("/sys/devices/system/cpu/cpu0/topology/
thread_siblings", 'r')testcases/kernel/power_management/lib/sched_mc.py +18
-0+ threads_count = 0 + for line in file_cpuinfo: + core_grps = line.split(",") + for i in range(0, len(core_grps)): + cpumask=int(core_grps[i]) + while cpumask > 0: + threads_count = threads_count + 1 + cpumask = cpumask >> 1 + return threads_count + except Exception, details: + print "INFO: Failed to get threaded siblings count", details + sys.exit(1) + +def get_core_sibling_count(): + ''' Return number of threads in cpu0 + ''' + try: + file_cpuinfo = open("/sys/devices/system/cpu/cpu0/topology/
core_siblings", 'r')testcases/kernel/power_management/lib/sched_mc.py +13
-0+ cores_count = 0 + for line in file_cpuinfo: + core_grps = line.split(",") + for i in range(0, len(core_grps)): + cpumask=int(core_grps[i]) + while cpumask > 0: + cores_count = cores_count + 1 + cpumask = cpumask >> 1 + return cores_count + except Exception, details: + print "INFO: Failed to get core siblings count", details + sys.exit(1) +def
is_multi_socket():
'''Return 1 if the system is multi socket else return 0 '''testcases/kernel/power_management/lib/sched_mc.py +2
-9@@ -81,15 +123,8 @@ def is_hyper_threaded(): '''Return 1 if the system is hyper threaded else return 0 ''' try: - file_cpuinfo = open("/proc/cpuinfo", 'r') - for line in file_cpuinfo: - if line.startswith('siblings'): - siblings = line.split(":") - if line.startswith('cpu cores'): - cpu_cores = line.split(":") - break - if int( siblings[1] ) / int( cpu_cores[1] )> 1: - file_cpuinfo.close() + threads_count = get_hyper_thread_count() + if threads_count > 1: return 1 else: return 0@@ -98,53 +133,33 @@ def is_hyper_threaded(): sys.exit(1)def
is_multi_core():testcases/kernel/power_management/lib/sched_mc.py +5
-23- ''' Return true if system has sockets has multiple cores + ''' Return true if system has sockets with multiple cores ''' try: - file_cpuinfo = open("/proc/cpuinfo", 'r') - for line in file_cpuinfo: - if line.startswith('siblings'): - siblings = line.split(":") - if line.startswith('cpu cores'): - cpu_cores = line.split(":") - break - - if int( siblings[1] ) == int( cpu_cores[1] ): - if int( cpu_cores[1] ) > 1: - multi_core = 1 - else: - multi_core = 0 + cores_count = get_core_sibling_count() + if cores_count > 1: + return 1 else: - num_of_cpus = int(siblings[1]) / int(cpu_cores[1]) - if num_of_cpus > 1: - multi_core = 1 - else: - multi_core = 0 - file_cpuinfo.close() - return multi_core + return 0 except Exception: print "Failed to check if system is multi core system" sys.exit(1) -def get_hyper_thread_count(): - ''' Return number of threads in CPU. For eg for x3950 thisfunction
- would return 2. In future if 4 threads are supported in
CPU, thistestcases/kernel/power_management/lib/sched_mc.py +11
-12- routine would return 4 +def is_quad_core(): + ''' + Read sys topology info and check if system is Quad core ''' try: - file_cpuinfo = open("/proc/cpuinfo", 'r') - for line in file_cpuinfo: - if line.startswith('siblings'): - siblings = line.split(":") - if line.startswith('cpu cores'): - cpu_cores = line.split(":") - break - return( int( siblings[1] ) / int( cpu_cores[1] ) ) - except Exception: - print "Failed to check if system is hyper-threaded" + cpu_cores = get_core_sibling_count() + if cpu_cores == 4: + return(1) + else: + return(0) + except IOError, e: + print "Failed in function to check if system is quad core", e sys.exit(1) - +def
map_cpuid_pkgid():
''' Routine to map physical package id to cpu id '''
testcases/kernel/power_management/lib/sched_mc.py def generate_sibling_list(): · line 209
Quoted 9 lines
testcases/kernel/power_management/lib/sched_mc.py +2
-4@@ -190,10 +205,21 @@ def generate_sibling_list(): try: for i in range(0, cpu_count): siblings_file = '/sys/devices/system/cpu/cpu%s' % i - siblings_file += '/topology/thread_siblings_list' - threads_sibs = open(siblings_file).read().rstrip() - thread_ids = threads_sibs.split("-") - + siblings_file += '/topology/thread_siblings' + threads_sibs = open(siblings_file).read().split(",")
Leaked filehandle?
Quoted 107 lines
testcases/kernel/power_management/lib/sched_mc.py +14
-1+ thread_ids = [] + cpu_id=0 + mask=1 + + for j in range(len(threads_sibs)-1, 0, -1): + for k in range(0, 8): + mask_bit_set=mask & int(threads_sibs[j],16) + if mask_bit_set != 0: + if not cpu_id in thread_ids: + thread_ids.append(cpu_id) + mask = mask << 1 + cpu_id += 1 + if not thread_ids in siblings_list: siblings_list.append(thread_ids) except Exception, details:@@ -211,7 +237,7 @@ def get_siblings(cpu_id): for j in siblings_list[i]: # Exclude cpu_id in the list of siblings if j != cpu_id: - cpus += j + cpus += str(j) return cpus return cpus except Exception, details:@@ -276,17 +302,6 @@ def set_sched_smt_power(sched_smt_level) print "Could not set sched_smt_power_savings to",
sched_smt_level, e
sys.exit(1)testcases/kernel/power_management/lib/sched_mc.py +0
-11-def set_timer_migration_interface(value): - ''' Set value of timer migration interface to a value - passed as argument - ''' - try: - os.system('echo %s > \ - /proc/sys/kernel/timer_migration 2>/dev/null' % value) - except OSError, e: - print "Could not set timer_migration to ", value, e - sys.exit(1) -def
get_job_count(stress, workload, sched_smt):
''' Returns number of jobs/threads to be triggered '''testcases/kernel/power_management/lib/sched_mc.py +0
-19@@ -585,25 +600,6 @@ def expand_range(range_val): except Exception, details: print "INFO: expand_pkg_grps failed ", details -def is_quad_core(): - ''' - Read /proc/cpuinfo and check if system is Quad core - ''' - try: - cpuinfo = open('/proc/cpuinfo', 'r') - for line in cpuinfo: - if line.startswith('cpu cores'): - cores = line.split("cpu cores") - num_cores = cores[1].split(":") - cpuinfo.close() - if int(num_cores[1]) == 4: - return(1) - else: - return(0) - except IOError, e: - print "Failed to get cpu core information", e - sys.exit(1) -def
validate_cpugrp_map(cpu_group, sched_mc_level, sched_smt_level):
'''
Verify if cpugrp belong to same packagetestcases/kernel/power_management/lib/sched_mc.py +0
-1@@ -612,7 +608,7 @@ def validate_cpugrp_map(cpu_group, sched try: if is_hyper_threaded(): for pkg in sorted(cpu_map.keys()): - # if CPU utilized is across package this conditionwill be true
+ # if CPU utilized is across package this condition will
be true
iflen(modi_cpu_grp)!=len(cpu_group):
break
for core in sorted(cpu_map[pkg].keys()):testcases/kernel/power_management/lib/sched_mc.py +4
-4@@ -724,21 +720,21 @@ def validate_cpu_consolidation(stress, w utilization += int(get_cpu_utilization ("cpu%s" %sib_list[i])) else: utilization = stats_percentage[l][1] - if utilization > 40: + if utilization > THRES_HT_KERNBENCH: cpus_utilized.append(int(cpu_id[1])) if siblings != "": for i in range(0, len(sib_list)): cpus_utilized.append(int(sib_list[i])) else: # This threshold wuld be modified based on results - if stats_percentage[l][1] > 40: + if stats_percentage[l][1] > THRES_HT: cpus_utilized.append(int(cpu_id[1])) else: if work_ld == "kernbench" : - if stats_percentage[l][1] > 50: + if stats_percentage[l][1] > THRES_KERNBENCH: cpus_utilized.append(int(cpu_id[1])) else: - if stats_percentage[l][1] > 70: + if stats_percentage[l][1] > THRES_EBIZZY: cpus_utilized.append(int(cpu_id[1])) cpus_utilized.sort()
Quoted 1 line
print "INFO: CPU's utilized ",
cpus_utilized
Two things:
1. You aren't cleaning up filehandles explicitly in this manner:
# open
try:
# read / write operations
finally:
# closeYou can wrap sys.exit calls inside the try-finally block. Finally, while you can do the following with 2.5+, it's not compatible with <= 2.4:
# open
try:
# read / write operations
[except:
# handle specific exceptions here.
]
finally:
# close2. sys.exit takes an optional string or an integer argument, where the former prints out the message and exits with $? => 1, iirc. help (sys.exit) will tell you all of the gory details...
HTH,
-Garrett
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [Patch 3/4]Python functions modified to run on Power platform
In reply to Poornima NayakQuoted 26 lines · Poornima Nayak
testcases/kernel/power_management/lib/sched_mc.py +26
-0+def get_hyper_thread_count(): + ''' Return number of threads in cpu0 + ''' + try: + file_cpuinfo = open("/sys/devices/system/cpu/cpu0/topology/thread_siblings", 'r') + threads_count = 0 + for line in file_cpuinfo: + core_grps = line.split(",") + for i in range(0, len(core_grps)): + cpumask=int(core_grps[i]) + while cpumask > 0: + threads_count = threads_count + 1 + cpumask = cpumask >> 1 + return threads_count + except Exception, details: + print "INFO: Failed to get threaded siblings count", details + sys.exit(1) + +def get_core_sibling_count(): + ''' Return number of threads in cpu0 + ''' + try: + file_cpuinfo = open("/sys/devices/system/cpu/cpu0/topology/core_siblings", 'r') + cores_count = 0 + for line in file_cpuinfo: + core_grps = line.split(",")
testcases/kernel/power_management/lib/sched_mc.py def count_num_sockets(): · line 109
Quoted 10 lines
testcases/kernel/power_management/lib/sched_mc.py +10
-0+ for i in range(0, len(core_grps)): + cpumask=int(core_grps[i]) + while cpumask > 0: + cores_count = cores_count + 1 + cpumask = cpumask >> 1 + return cores_count + except Exception, details: + print "INFO: Failed to get core siblings count", details + sys.exit(1) +
We could avoid the code repetition above.
def get_entity_count(entity):
try:
file_cpuinfo =
open("/sys/devices/system/cpu/cpu0/topology/" + entity + "siblings", 'r)
.
.
.
except
.
.
.def get_hyper_thread_count():
return get_entity_count("thread")
def get_core_sibling_count():
return get_entity_count("core")
Signature · 13 lines
Thanks and Regards gautham ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 4/4 Readme modified based on review comments
In reply to Poornima NayakPatch to update readme with information on how to use Power management testcases to test consolidation testcases.
testcases/kernel/power_management/README +5 -1
@@ -77,6 +77,8 @@ Power Management 1 FAIL : Required Then either configuration is not set or the system won't support. +Command to test CPU consolidation & ILB testcases on any system syntax is 'runltp -f power_management_tests_exclusive'. CPU consolidation testcases has to be triggered on a system which is totally idle i.e do not execute exclusive testcases on KVM/xen test setup. + For CPU consolidation verification ebizzy is included in utils directory of LTP. To run cpu consolidation test user has to provide -w <workload> -l <sched_mc_level>. Refer to README in LTPROOT/utils/benchmark/ebizzy-0.2 directory for details of ebizzy.
@@ -84,4 +86,6 @@ Refer to README in LTPROOT/utils/benchma To test CPU consolidation for sched_mc 2 kernbench has to run. Kernbench needs linux kernel source as input in /root directory . For example download from http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.4.tar.bz2. If Linux kernel source not found kernbench wiil not execute. CPU consolidation testcases will not execute if number of CPU's in package is less then 2. If system is hyper threaded but number of CPU is 1 only sched_smt testcases will be excuted. For better coverage of testcases select a system which is atleast quad core and then hyper threaded so that you will observe 8 CPU's in each package. -Timer migration interface test will execute on kernel versions 2.6.31 and above. Timer migration functionality verification testcases will be executed only on suitable architecture like quad core or the number of CPU's in each package should be atleast 4 and above +Timer migration interface test will execute on kernel versions 2.6.31 and above. + +On Power platform sched_smt & cpu_idle testcases will be executed.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [Patch 4/4]Readme modified based on review comments
Quoted 17 lines · Poornima Nayak
Patch to update readme with information on how to use Power management testcases
to test consolidation testcases.Signed-off-by poornima nayak <[email protected]>diff -uprN ltp-intermediate-20091209.orig/testcases/kernel/ power_management/README ltp-intermediate-20091209.fixes/testcases/
kernel/power_management/README
--- ltp-intermediate-20091209.orig/testcases/kernel/power_management/
README 2009-12-09 13:18:25.000000000 +0530
+++ ltp-intermediate-20091209.fixes/testcases/kernel/
power_management/README 2009-12-24 23:12:55.293026448 +0530(quoted diff) +0
-0@@ -77,6 +77,8 @@ Power Management 1 FAIL : RequiredThen either configuration is not set or the system won't support.
Quoted 12 lines
+Command to test CPU consolidation & ILB testcases on any system syntax is 'runltp -f
power_management_tests_exclusive'. CPU consolidation testcases has to be triggered on a system which is totally idle i.e do not execute exclusive testcases on KVM/xen test setup.
+
For CPU consolidation verification ebizzy is included in utils directory of LTP.
To run cpu consolidation test user has to provide -w <workload> -l <sched_mc_level>.
Refer to README in LTPROOT/utils/benchmark/ebizzy-0.2 directory for details of ebizzy.
This is 0.3 now.
Quoted 27 lines
(quoted diff) +0
-0@@ -84,4 +86,6 @@ Refer to README in LTPROOT/utils/benchmaTo test CPU consolidation for
sched_mc2 kernbench has to run.
Kernbench needs linux kernel source as input in /root directory .
For example download from http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.4.tar.bz2
. If Linux kernel source not found kernbench wiil not execute.
CPU consolidation testcases will not execute if number of CPU's in
package is less then 2. If system is hyper threaded but number of
CPU is 1 onlysched_smttestcases will be excuted. For better
coverage of testcases select a system which is atleast quad core and
then hyper threaded so that you will observe 8 CPU's in each package.-Timer migration interface test will execute on kernel versions 2.6.31 and above. Timer migration functionality verification testcases will be executed only on suitable architecture like quad core or the number of CPU's in each package should be atleast 4 and above
+Timer migration interface test will execute on kernel versions 2.6.31 and above.(quoted diff) +2
-4+ +On Power platform sched_smt & cpu_idle testcases will be executed. --- --- --- ---------------------------------------------------------------------This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support
Quoted 8 lines
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 101 lines · Poornima Nayak
Patch to enable Power management testcases in LTP to run on Power platform
Signed-off-by poornima nayak <[email protected]>diff -uprN ltp-intermediate-20091209.orig/testcases/kernel/
power_management/runpwtests.shltp-intermediate-20091209.fixes/testcases/kernel/power_management/runpwtests.sh
--- ltp-intermediate-20091209.orig/testcases/kernel/power_management/runpwtests.sh2009-12-09 13:18:25.000000000 +0530
+++ ltp-intermediate-20091209.fixes/testcases/kernel/power_management/runpwtests.sh2009-12-24 23:16:39.859044825 +0530testcases/kernel/power_management/runpwtests.sh +12
-0@@ -28,10 +28,21 @@ # History: 26 Aug 2008 - Created this file # 03 Nov 2008 - Added CPUIDLE sysfs testcase # +# Function: main +# +# Description: - Execute all tests, exit with test status. +# +# Exit: - zero on success +# - non-zero on failure. +# + +#List of reusable functions defined in pm_include.sh +. ./pm_include.sh + +RC=0 #Return status # Exporting Required variablesexport TST_TOTAL=1
-#LTPTMP=${TMP}
export PATH=${PATH}:.
export TCID="Power_Management"
export TST_COUNT=0(quoted diff) +0
-0@@ -40,48 +51,39 @@ export analysis="/proctstat"YES=0
NO=1testcases/kernel/power_management/runpwtests.sh +0
-11-#List of reusable functions defined in pm_include.sh -. ./pm_include.sh - -# Function: main -# -# Description: - Execute all tests, exit with test status. -# -# Exit: - zero on success -# - non-zero on failure. -# -RC=0 #Return status# Checking required kernel version and architecture
tst_kvercmp2 6 21; rc=$?
if [ $rc -ne 1 -a $rc -ne 2 ] ; then
-tst_resmTCONF "Kernel version not supported; not running
testcases"(quoted diff) +1
-1- exit 0 + tst_resm TCONF "Kernel version not supported; not runningtestcases"
+ exit 0
elsetestcases/kernel/power_management/runpwtests.sh +6
-7- case "$(uname -m)" in - i[4-6]86|x86_64) + case "$(uname -m)" in + i[4-6]86|x86_64) + ;; + powerpc|ppc|powerpc64|ppc64) ;; - *) - tst_resm TCONF "Arch not supported; not running testcases" - exit 0 - ;; - esac + *) + tst_resm TCONF "Arch not supported; not runningtestcases"
testcases/kernel/power_management/runpwtests.sh +3
-0+ exit 0 + ;; + esacfi
tst_kvercmp2 6 29; rc=$?
if [ $rc -eq 2 ] ; thentestcases/kernel/power_management/runpwtests.sh +2
-2- max_sched_mc=2 - max_sched_smt=2 + max_sched_mc=2 + max_sched_smt=2else
testcases/kernel/power_management/runpwtests.sh +2
-2- max_sched_mc=1 - max_sched_smt=1 + max_sched_mc=1 + max_sched_smt=1fi
tst_kvercmp2 6 31; rc=$?
if [ $rc -eq 1 -o $rc -eq 2 ] ; thentestcases/kernel/power_management/runpwtests.sh +1
-1- timer_migr_support_compatible=1 + timer_migr_support_compatible=0else
testcases/kernel/power_management/runpwtests.sh +1
-1- timer_migr_support_compatible=0 + timer_migr_support_compatible=1
Quoted 1 line
fi
Why did you invert the logic here? $? => 0 says the kernel version is less, 1 that it's equal, and 2 that it's greater than the version specified.
Quoted 50 lines
is_hyper_threaded; hyper_threaded=$?(quoted diff) +0
-0@@ -90,7 +92,6 @@ is_multi_core; multi_core=$?
is_dual_core; dual_core=$?#Checking
sched_mcsysfs interface
-#check_config.shconfig_sched_mc|| RC=$?
TST_COUNT=1
if [ $multi_socket -eq $YES -a $multi_core -eq $YES ] ; then
if [ -f/sys/devices/system/cpu/sched_mc_power_savings] ; then(quoted diff) +0
-0@@ -103,6 +104,25 @@ if [ $multi_socket -eq $YES -a $multi_co else tst_resm TCONF "Required kernel configuration for SCHED_MCNOT set"
fitestcases/kernel/power_management/runpwtests.sh +17
-0+ + : $(( TST_COUNT+=1)) + if [ -f /proc/sys/kernel/timer_migration ]; then + if [ $timer_migr_support_compatible -eq $YES ]; then + if test_timer_migration.sh; then + tst_resm TPASS "Timer Migration interface test" + else + RC=$? + tst_resm TFAIL "Timer migration interface test" + fi + fi + else + if [ $supp -eq $YES ]; then + RC=$? + tst_resm TFAIL "Timer migration interface missing" + else + tst_resm TCONF "Kernel version does not support Timermigration"
(quoted diff) +2
-0+ fi + fielse
if [ -f/sys/devices/system/cpu/sched_mc_power_savings] ; then
tst_resmTFAIL "sched_mc_power_savingsinterface in system
which is not a multi socket &(/) multi core"(quoted diff) +0
-0@@ -135,7 +155,6 @@ elsefi
# Checking cpufreq sysfs interface files -#check_config.sh
config_cpu_freq|| RC=$?
: $((TST_COUNT+= 1 ))
if [ -d/sys/devices/system/cpu/cpu0/cpufreq] ; then
ifcheck_cpufreq_sysfs_files.sh; then(quoted diff) +0
-0@@ -187,12 +206,13 @@ elsefi
# sched_domain test
testcases/kernel/power_management/runpwtests.sh else · line 210
Quoted 3 lines
testcases/kernel/power_management/runpwtests.sh +2
-1-if ! type python > /dev/null ; then +which python > /dev/null +if [ $? -ne 0 ] ; then
type is a bourne shell builtin whereas which is a command. Furthermore, you can inline shell true / false checks in branch conditionals. So why did you revert this?
Quoted 33 lines
tst_resm TCONF "Python is not installed, CPU Consoldation\test cannot run"
else
if [ -f/sys/devices/system/cpu/sched_mc_power_savings] ; thentestcases/kernel/power_management/runpwtests.sh +1
-1- echo "max sched mc $max_sched_mc" + get_sched_values sched_mc; max_sched_mc=$? for sched_mc in `seq 0 $max_sched_mc`; do : $(( TST_COUNT+=1)) sched_domain.py -c $sched_mc; RC=$?@@ -210,25 +230,6 @@ else fifi
-: $(( TST_COUNT+=1))
testcases/kernel/power_management/runpwtests.sh +0
-15-if [ -f /proc/sys/kernel/timer_migration ]; then - if [ $timer_migr_support_compatible -eq $YES ]; then - if test_timer_migration.sh; then - tst_resm TPASS "Timer Migration interface test" - else - RC=$? - tst_resm TFAIL "Timer migration interface test" - fi - fi -else - if [ $timer_migr_support_compatible -eq $YES ]; then - RC=$? - tst_resm TFAIL "Timer migration interface missing" - else - tst_resm TCONF "Kernel version does not support Timermigration"
testcases/kernel/power_management/runpwtests.sh +0
-3- fi -fi -
Quoted 1 line
if [ $# -gt 0 -a "$1" = "-exclusive" ]; then
Sorry for not noticing this sooner. $1 and -exclusive should be prefixed by a character, e.g. x or this will be reported as a [(1) syntax error.
Quoted 22 lines
# Test CPU consolidation
if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then(quoted diff) +0
-1@@ -266,7 +267,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; fi - if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES -a$multi_core -eq $NO ]; then
testcases/kernel/power_management/runpwtests.sh +1
-0+ if [ $hyper_threaded -eq $YES ]; then #Testcase to validate consolidation at core level for sched_smt in `seq 0 $max_sched_smt`; do if [ $sched_smt -eq 2 ]; then@@ -319,7 +320,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; fi # Verify threads consolidation stops when sched_smt is disabledin HT systems
testcases/kernel/power_management/runpwtests.sh +1
-1- if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES ]; then + if [ $hyper_threaded -eq $YES ]; then # Vary only sched_smt from 1 to 0 when workload is runningand ensure that
Quoted 3 lines
# tasks do not consolidate to single core when sched_smt is
set to 0
: $(( TST_COUNT += 1 ))Thanks,
-Garrett
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Garrett Cooper <[email protected]>
12/25/2009 01:51 AM
To
Poornima Nayak <[email protected]>
cc
"[email protected]" <[email protected]>, "[email protected]" <[email protected]>, "[email protected]" <[email protected]>, [email protected]
Subject
Re: [LTP] [Patch 1/4]Master script modified to enable testcases to run on Power
Quoted 101 lines · Poornima Nayak
Patch to enable Power management testcases in LTP to run on Power platform
Signed-off-by poornima nayak <[email protected]>diff -uprN ltp-intermediate-20091209.orig/testcases/kernel/
power_management/runpwtests.shltp-intermediate-20091209.fixes/testcases/kernel/power_management/runpwtests.sh
--- ltp-intermediate-20091209.orig/testcases/kernel/power_management/runpwtests.sh2009-12-09 13:18:25.000000000 +0530
+++ ltp-intermediate-20091209.fixes/testcases/kernel/power_management/runpwtests.sh2009-12-24 23:16:39.859044825 +0530testcases/kernel/power_management/runpwtests.sh +12
-0@@ -28,10 +28,21 @@ # History: 26 Aug 2008 - Created this file # 03 Nov 2008 - Added CPUIDLE sysfs testcase # +# Function: main +# +# Description: - Execute all tests, exit with test status. +# +# Exit: - zero on success +# - non-zero on failure. +# + +#List of reusable functions defined in pm_include.sh +. ./pm_include.sh + +RC=0 #Return status # Exporting Required variablesexport TST_TOTAL=1
-#LTPTMP=${TMP}
export PATH=${PATH}:.
export TCID="Power_Management"
export TST_COUNT=0(quoted diff) +0
-0@@ -40,48 +51,39 @@ export analysis="/proctstat"YES=0
NO=1testcases/kernel/power_management/runpwtests.sh +0
-11-#List of reusable functions defined in pm_include.sh -. ./pm_include.sh - -# Function: main -# -# Description: - Execute all tests, exit with test status. -# -# Exit: - zero on success -# - non-zero on failure. -# -RC=0 #Return status# Checking required kernel version and architecture
tst_kvercmp2 6 21; rc=$?
if [ $rc -ne 1 -a $rc -ne 2 ] ; then
-tst_resmTCONF "Kernel version not supported; not running
testcases"(quoted diff) +1
-1- exit 0 + tst_resm TCONF "Kernel version not supported; not runningtestcases"
+ exit 0
elsetestcases/kernel/power_management/runpwtests.sh +6
-7- case "$(uname -m)" in - i[4-6]86|x86_64) + case "$(uname -m)" in + i[4-6]86|x86_64) + ;; + powerpc|ppc|powerpc64|ppc64) ;; - *) - tst_resm TCONF "Arch not supported; not running testcases" - exit 0 - ;; - esac + *) + tst_resm TCONF "Arch not supported; not runningtestcases"
testcases/kernel/power_management/runpwtests.sh +3
-0+ exit 0 + ;; + esacfi
tst_kvercmp2 6 29; rc=$?
if [ $rc -eq 2 ] ; thentestcases/kernel/power_management/runpwtests.sh +2
-2- max_sched_mc=2 - max_sched_smt=2 + max_sched_mc=2 + max_sched_smt=2else
testcases/kernel/power_management/runpwtests.sh +2
-2- max_sched_mc=1 - max_sched_smt=1 + max_sched_mc=1 + max_sched_smt=1fi
tst_kvercmp2 6 31; rc=$?
if [ $rc -eq 1 -o $rc -eq 2 ] ; thentestcases/kernel/power_management/runpwtests.sh +1
-1- timer_migr_support_compatible=1 + timer_migr_support_compatible=0else
testcases/kernel/power_management/runpwtests.sh +1
-1- timer_migr_support_compatible=0 + timer_migr_support_compatible=1
Quoted 1 line
fi
Why did you invert the logic here? $? => 0 says the kernel version is less, 1 that it's equal, and 2 that it's greater than the version specified.
If Kernel version is less then that particular kernel is not suitable for Timer Migration test.
Only if kernel version is 2.6.31 and above then Timer migration test has to be executed. In the script YES=0, NO=1
Quoted 50 lines
is_hyper_threaded; hyper_threaded=$?(quoted diff) +0
-0@@ -90,7 +92,6 @@ is_multi_core; multi_core=$?
is_dual_core; dual_core=$?#Checking
sched_mcsysfs interface
-#check_config.shconfig_sched_mc|| RC=$?
TST_COUNT=1
if [ $multi_socket -eq $YES -a $multi_core -eq $YES ] ; then
if [ -f/sys/devices/system/cpu/sched_mc_power_savings] ; then(quoted diff) +0
-0@@ -103,6 +104,25 @@ if [ $multi_socket -eq $YES -a $multi_co else tst_resm TCONF "Required kernel configuration for SCHED_MCNOT set"
fitestcases/kernel/power_management/runpwtests.sh +17
-0+ + : $(( TST_COUNT+=1)) + if [ -f /proc/sys/kernel/timer_migration ]; then + if [ $timer_migr_support_compatible -eq $YES ]; then + if test_timer_migration.sh; then + tst_resm TPASS "Timer Migration interface test" + else + RC=$? + tst_resm TFAIL "Timer migration interface test" + fi + fi + else + if [ $supp -eq $YES ]; then + RC=$? + tst_resm TFAIL "Timer migration interface missing" + else + tst_resm TCONF "Kernel version does not support Timermigration"
(quoted diff) +2
-0+ fi + fielse
if [ -f/sys/devices/system/cpu/sched_mc_power_savings] ; then
tst_resmTFAIL "sched_mc_power_savingsinterface in system
which is not a multi socket &(/) multi core"(quoted diff) +0
-0@@ -135,7 +155,6 @@ elsefi
# Checking cpufreq sysfs interface files -#check_config.sh
config_cpu_freq|| RC=$?
: $((TST_COUNT+= 1 ))
if [ -d/sys/devices/system/cpu/cpu0/cpufreq] ; then
ifcheck_cpufreq_sysfs_files.sh; then(quoted diff) +0
-0@@ -187,12 +206,13 @@ elsefi
# sched_domain test
testcases/kernel/power_management/runpwtests.sh else · line 210
Quoted 3 lines
testcases/kernel/power_management/runpwtests.sh +2
-1-if ! type python > /dev/null ; then +which python > /dev/null +if [ $? -ne 0 ] ; then
type is a bourne shell builtin whereas which is a command. Furthermore, you can inline shell true / false checks in branch conditionals. So why did you revert this?
Will modify the patch accordingly.
Quoted 33 lines
tst_resm TCONF "Python is not installed, CPU Consoldation\test cannot run"
else
if [ -f/sys/devices/system/cpu/sched_mc_power_savings] ; thentestcases/kernel/power_management/runpwtests.sh +1
-1- echo "max sched mc $max_sched_mc" + get_sched_values sched_mc; max_sched_mc=$? for sched_mc in `seq 0 $max_sched_mc`; do : $(( TST_COUNT+=1)) sched_domain.py -c $sched_mc; RC=$?@@ -210,25 +230,6 @@ else fifi
-: $(( TST_COUNT+=1))
testcases/kernel/power_management/runpwtests.sh +0
-15-if [ -f /proc/sys/kernel/timer_migration ]; then - if [ $timer_migr_support_compatible -eq $YES ]; then - if test_timer_migration.sh; then - tst_resm TPASS "Timer Migration interface test" - else - RC=$? - tst_resm TFAIL "Timer migration interface test" - fi - fi -else - if [ $timer_migr_support_compatible -eq $YES ]; then - RC=$? - tst_resm TFAIL "Timer migration interface missing" - else - tst_resm TCONF "Kernel version does not support Timermigration"
testcases/kernel/power_management/runpwtests.sh +0
-3- fi -fi -
Quoted 1 line
if [ $# -gt 0 -a "$1" = "-exclusive" ]; then
Sorry for not noticing this sooner. $1 and -exclusive should be prefixed by a character, e.g. x or this will be reported as a [(1) syntax error.
Based on your comments I am doing it, as such I have not observed syntax error while executing these testcases
Quoted 22 lines
# Test CPU consolidation
if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then(quoted diff) +0
-1@@ -266,7 +267,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; fi - if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES -a$multi_core -eq $NO ]; then
testcases/kernel/power_management/runpwtests.sh +1
-0+ if [ $hyper_threaded -eq $YES ]; then #Testcase to validate consolidation at core level for sched_smt in `seq 0 $max_sched_smt`; do if [ $sched_smt -eq 2 ]; then@@ -319,7 +320,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; fi # Verify threads consolidation stops when sched_smt is disabledin HT systems
testcases/kernel/power_management/runpwtests.sh +1
-1- if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES ]; then + if [ $hyper_threaded -eq $YES ]; then # Vary only sched_smt from 1 to 0 when workload is runningand ensure that
Quoted 3 lines
# tasks do not consolidate to single core when sched_smt is
set to 0
: $(( TST_COUNT += 1 ))Thanks,
-Garrett
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list