Skip to contentSkip to conversation

To test consolidation resets when interfaces are set to 0

PATCH In review Poornima Nayak 2 participants 12 messages Sep 21, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 To test consolidation resets when interfaces are set to 0

CPU consolidation testcase modified to test when sched_mc &(/) sched_smt is set to Zero processes dont consolidate to single package or CPU.

testcases/kernel/power_management/cpu_consolidation.py +94 -18
diff -uprN ltp-full-20090831/testcases/kernel/power_management/cpu_consolidation.py ltp-full-20090831_patched/testcases/kernel/power_management/cpu_consolidation.py
@@ -5,6 +5,7 @@
 
 import os
 import sys
+import time
 LIB_DIR = "%s/testcases/kernel/power_management/lib" % os.environ['LTPROOT']
 sys.path.append(LIB_DIR)
 from optparse import OptionParser
@@ -22,9 +23,12 @@ def main(argv=None):
 
     usage = "-w"
     parser = OptionParser(usage)
-    parser.add_option("-c", "--mc_level", dest="mc_level",
+    parser.add_option("-v", "--variation_test", dest="vary_mc_smt",
+        default=False, action="store_true", help="Vary sched_mc & sched_smt. \
+            -c and -t inputs are initial value of sched_mc & sched_smt")
+    parser.add_option("-c", "--mc_value", dest="mc_value",
         default=0, help="Sched mc power saving value 0/1/2")
-    parser.add_option("-t", "--smt_level", dest="smt_level",
+    parser.add_option("-t", "--smt_value", dest="smt_value",
         default=0, help="Sched smt power saving value 0/1/2")
     parser.add_option("-w", "--workload", dest="work_ld",
         default="ebizzy", help="Workload can be ebizzy/kernbench")
@@ -35,22 +39,94 @@ def main(argv=None):
     try:
         count_num_cpu()
         count_num_sockets()
-        if is_multi_socket():
-            set_sched_mc_power(options.mc_level)
-        if is_hyper_threaded():
-            set_sched_smt_power(options.smt_level)
-        map_cpuid_pkgid()
-        print "INFO: Created table mapping cpu to package"
-        background="no"
-        duration=60
-        pinned ="no"
-        trigger_workld(options.work_ld, options.stress, duration, background, pinned)
-        generate_report()
-        status = validate_cpu_consolidation(options.work_ld,options.mc_level, options.smt_level)
-        reset_schedmc()
-        if is_hyper_threaded():
-            reset_schedsmt()
-        return(status)        
+        # User would set option -v / -vc / -vt to test cpu consolidation
+        # gets disabled when sched_mc &(/) sched_smt is disabled when
+        # workload is already running in the system 
+        if options.vary_mc_smt:
+
+            # Since same code is used for testing package consolidation and core
+            # consolidation is_multi_socket & is_hyper_threaded check is done
+            if is_multi_socket():
+                if options.mc_value:
+                    set_sched_mc_power(options.mc_value)
+                    mc_value=int(options.mc_value)
+                else:    
+                    set_sched_mc_power(1)
+                    mc_value=int(options.mc_value)
+            if is_hyper_threaded():
+                if options.smt_value:
+                    set_sched_smt_power(options.smt_value)
+                    smt_value=int(options.smt_value)
+                else:
+                    set_sched_smt_power(1)
+                    smt_value=1
+
+            #Generate arguments for trigger workload, run workload in background
+            map_cpuid_pkgid()
+            background="yes"
+            duration=360
+            pinned="no"
+            if int(options.mc_value) < 2:
+                trigger_ebizzy (smt_value, "partial", duration, background, pinned)
+                work_ld="ebizzy"
+                #Wait for 120 seconds and then validate cpu consolidation works
+                #When sched_mc & sched_smt is set
+                import time
+                time.sleep(120)
+            else:
+                #Wait for 120 seconds and then validate cpu consolidation works
+                #When sched_mc & sched_smt is set
+                trigger_kernbench (smt_value, "partial", background, pinned) 
+                work_ld="kernbench"
+                import time
+                time.sleep(240)
+
+            generate_report()
+            status = validate_cpu_consolidation(work_ld, mc_value, smt_value)
+            if status == 0:
+                print "INFO: Consolidation worked sched_smt &(/) sched_mc is set"
+                #Disable sched_smt & sched_mc interface values
+                if (options.vary_mc_smt and options.mc_value) and is_multi_socket():
+                    set_sched_mc_power(0)
+                    #Reset sched_smt bcoz when sched_smt is set process still
+                    #continue to consolidate
+                    if is_hyper_threaded():
+                        set_sched_smt_power(0)
+                if (options.vary_mc_smt and options.smt_value) and is_hyper_threaded():
+                    set_sched_smt_power(0)
+                time.sleep(120)
+                generate_report()
+                status = validate_cpu_consolidation(options.work_ld,options.mc_value, options.smt_value)
+                #CPU consolidation should fail as sched_mc &(/) sched_smt is disabled
+                if status == 1:
+                    return(0)
+                else:
+                    return(1)
+            else:
+                print "INFO: CPU consolidation failed when sched_mc &(/) \
+sched_smt was enabled. This is pre-requisite to proceed"
+                return(status)
+        else:           
+            #The else part of the code validates behaviour of sched_mc
+            # and sched_smt set to 0, 1 & 2
+            if is_multi_socket():
+                set_sched_mc_power(options.mc_value)
+            if is_hyper_threaded():
+                set_sched_smt_power(options.smt_value)
+                #Commented after observing changes in behaviour in 2.6.31-rc7
+                #stress="thread"
+            map_cpuid_pkgid()
+            print "INFO: Created table mapping cpu to package"
+            background="no"
+            duration=60
+            pinned ="no"
+            trigger_workld( options.smt_value, options.work_ld, options.stress, duration, background, pinned)
+            generate_report()
+            status = validate_cpu_consolidation(options.work_ld,options.mc_value, options.smt_value)
+            reset_schedmc()
+            if is_hyper_threaded():
+                reset_schedsmt()
+            return(status)        
     except Exception, details:
         print "INFO: CPU consolidation failed", details
         return(1)

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

PATCH 2/6 To fix issue in get_sched_values

get_sched_values was returning 1 & 0 instead of max sched_mc & max sched_smt. This patch fixes the issue in the first version of this file.

testcases/kernel/power_management/get_sched_values.c +2 -8
diff -uprN ltp-full-20090831/testcases/kernel/power_management/get_sched_values.c ltp-full-20090831_patched/testcases/kernel/power_management/get_sched_values.c
@@ -40,14 +40,8 @@ int main(int argc, char **argv)
 	{
 		param = argv[1];
 		if (strcmp(param, "sched_mc")==0)
-			if (get_supp_sched_mc() == 0)
-				return 0;
-			else
-				return 1;
+			return (get_supp_sched_mc());
 		if (strcmp(param, "sched_smt")==0)
-                        if (get_supp_sched_smt() == 0)
-                                return 0;
-                        else
-                                return 1;
+                        return (get_supp_sched_smt());
 	}
 }

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw

PATCH 3/6 To incorporate changes in reusable function

In reply to Poornima Nayak

ILB testcase uses trigger workload to pin a task to CPU. This patch is to incorporate the changes in the prototype of function testcase invokes to trigger workload.

testcases/kernel/power_management/ilb_test.py +4 -2
diff -uprN ltp-full-20090831/testcases/kernel/power_management/ilb_test.py ltp-full-20090831_patched/testcases/kernel/power_management/ilb_test.py
@@ -42,13 +42,15 @@ def main(argv=None):
         background="no"
         duration=60
         pinned="yes"
-        trigger_workld(options.work_ld, "single_job", duration, background, pinned)
+
+        trigger_workld(options.smt_level,options.work_ld, "single_job", duration, background, pinned)
         generate_loc_intr_report()
         status = validate_ilb(options.mc_level, options.smt_level)
         reset_schedmc()
         if is_hyper_threaded():
             reset_schedsmt()
-        return(status)        
+        return(status)     
+   
     except Exception, details:
         print "INFO: Idle Load Balancer test failed", details
         return(1)

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw

PATCH 4/6 To include Additional 5 new test cases

In reply to Poornima Nayak

Additional 5 new testcases to test cpu consolidation resets when sched_smt &(/) sched_mc is reset to zero.

testcases/kernel/power_management/runpwtests.sh +123 -84
diff -uprN ltp-full-20090831/testcases/kernel/power_management/runpwtests.sh ltp-full-20090831_patched/testcases/kernel/power_management/runpwtests.sh
@@ -170,6 +170,7 @@ if [ $? -ne 0 ] ; then
 test cannot run"
 else
 	get_sched_values sched_mc; max_sched_mc=$?
+    echo "max 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=$?
@@ -187,15 +188,17 @@ else
 fi
 
 : $(( TST_COUNT+=1))
+check_kv_arch "timer_migration"; supp=$?
 if [ -f /proc/sys/kernel/timer_migration ]; then
-	if test_timer_migration.sh; then
-        tst_resm TPASS "Timer Migration interface test"
-    else
-        RC=$?
-        tst_resm TFAIL "Timer migration interface test"
-    fi
+	if [ $supp -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
-	check_kv_arch "timer_migration"; supp=$? 
 	if [ $supp -eq $YES ]; then
 		RC=$?
 		tst_resm TFAIL "Timer migration interface missing"
@@ -204,52 +207,45 @@ else
 	fi
 fi
 
-: $(( TST_COUNT+=1))	
-if check_cpufreq_sysfs_files.sh; then
-        tst_resm TPASS "CPUFREQ sysfs tests"
-    else
-        RC=$?
-        tst_resm TFAIL "CPUFREQ sysfs tests "
-    fi
-
 if [ $# -gt 0 -a "$1" = "-exclusive" ]; then 
 	# Test CPU consolidation 
 	if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
-		work_loads_list="ebizzy kernbench"
 		for sched_mc in `seq 0 $max_sched_mc`; do
-			for work_load in ${work_loads_list}
-           	do
-				: $(( TST_COUNT += 1 ))
-				sched_mc_pass_cnt=0
-				for repeat_test in `seq 1  10`; do
-					#Testcase to validate CPU consolidation for sched_mc
-					if cpu_consolidation.py -c $sched_mc -w $work_load ; then
-						: $(( sched_mc_pass_cnt += 1 ))
-					fi
-				done
-				analyze_package_consolidation_result $sched_mc $work_load $sched_mc_pass_cnt	
-			done	
+			: $(( TST_COUNT += 1 ))
+			sched_mc_pass_cnt=0
+			if [ $sched_mc -eq 2 ]; then
+				work_load="kernbench"
+			else
+				work_load="ebizzy"
+			fi
+			for repeat_test in `seq 1  10`; do
+				#Testcase to validate CPU consolidation for sched_mc
+				if cpu_consolidation.py -c $sched_mc -w $work_load ; then
+					: $(( sched_mc_pass_cnt += 1 ))
+				fi
+			done
+			analyze_package_consolidation_result $sched_mc $sched_mc_pass_cnt	
+			
 			if [ $hyper_threaded -eq $YES ]; then
 				for sched_smt in `seq 0 $max_sched_smt`; do
-					for work_load in ${work_loads_list}; do
-                   				: $(( TST_COUNT += 1 ))
-						sched_mc_smt_pass_cnt=0
-						for repeat_test in `seq 1  10`; do
-							# Testcase to validate CPU consolidation for
-							# for sched_mc & sched_smt with stress=50%
-							if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
-								: $(( sched_mc_smt_pass_cnt += 1 ))
-							fi
-							echo "sched_mc_smt_pass_cnt = $sched_mc_smt_pass_cnt"
-						done
-						analyze_package_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt
+					: $(( TST_COUNT += 1 ))
+					sched_mc_smt_pass_cnt=0
+					for repeat_test in `seq 1  10`; do
+						# Testcase to validate CPU consolidation for
+						# for sched_mc & sched_smt with stress=50%
+						if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
+							: $(( sched_mc_smt_pass_cnt += 1 ))
+						fi
 					done
+					analyze_package_consolidation_result $sched_mc $sched_mc_smt_pass_cnt $sched_smt
 				done
 			fi
 		done
+
 	fi
-	if [ $hyper_threaded -eq $YES ]; then
+	if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES ]; then
 		#Testcase to validate consolidation at core level
+		work_load="ebizzy"
 		sched_smt_pass_cnt=0
 		: $(( TST_COUNT += 1 ))
 		stress="thread"
@@ -259,61 +255,104 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; 
 			fi
 		done
 		analyze_core_consolidation_result $sched_smt $work_load $sched_smt_pass_cnt
+
+		# 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 ))
+		if cpu_consolidation.py -vt; then
+			tst_resm TPASS "CPU consolidation test by varying sched_smt"
+		else
+			tst_resm TFAIL "CPU consolidation test by varying sched_smt"
+		fi
 	fi
-        # Verify ILB runs in same package as workload
-        if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
-		work_loads_list="ebizzy kernbench"	
+
+	# Verify threads consolidation stops when sched_mc &(/) sched_smt is disabled
+    if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
+		: $(( TST_COUNT += 1 ))
+		# Vary sched_mc from 1 to 0 when workload is running and ensure that
+		# tasks do not consolidate to single package when sched_mc is set to 0
+		if cpu_consolidation.py -v -c 1; then
+            tst_resm TPASS "CPU consolidation test by varying sched_mc 1 to 0"
+        else
+            tst_resm TFAIL "CPU consolidation test by varying sched_mc 1 to 0"
+        fi
+
+		# Vary sched_mc from 2 to 0 when workload is running and ensure that
+        # tasks do not consolidate to single package when sched_mc is set to 0
+		: $(( TST_COUNT += 1 ))
+		if cpu_consolidation.py -v -c 2; then
+			tst_resm TPASS "CPU consolidation test by varying sched_mc 2 to 0"
+		else
+			tst_resm TFAIL "CPU consolidation test by varying sched_mc 2 to 0"
+		fi
+
+		if [ $hyper_threaded -eq $YES ]; then
+			# Vary sched_mc & sched_smt from 1 to 0 & 2 to 0 when workload is running and ensure that
+            # tasks do not consolidate to single package when sched_mc is set to 0
+            : $(( TST_COUNT += 1 ))
+			if cpu_consolidation.py -v -c 1 -t 1; then
+				tst_resm TPASS "CPU consolidation test by varying sched_mc \
+& sched_smt from 1 to 0"
+			else
+				tst_resm TFAIL "CPU consolidation test by varying sched_mc \
+& sched_smt from 1 to 0"
+			fi
+
+			: $(( TST_COUNT += 1 ))
+			if cpu_consolidation.py -v -c 2 -t 2; then
+				tst_resm TPASS "CPU consolidation test by varying sched_mc \
+ & sched_smt from 2 to 0"
+			else
+				tst_resm TFAIL "CPU consolidation test by varying sched_mc \
+ & sched_smt from 2 to 0"
+			fi
+		fi
+	fi
+
+    # Verify threads consolidation stops when is disabled in HT systems
+	if [ $hyper_threaded -eq $YES -a $multi_socket -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 ))
+		if cpu_consolidation.py -v -t 1; then
+			tst_resm TPASS "CPU consolidation test by varying sched_smt 1 to 0"
+		else
+			tst_resm TFAIL "CPU consolidation test by varying sched_smt 1 to 0"
+		fi
+	fi
+
+	# Verify ILB runs in same package as workload
+    if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
 		for sched_mc in `seq 0 $max_sched_mc`; do
-			for work_load in ${work_loads_list}
-			do
-				: $(( TST_COUNT += 1 ))
-                                ilb_test.py -c $sched_mc -w $work_load; RC=$?
-				if [ $RC -eq 0 ]; then
-					tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+			: $(( TST_COUNT += 1 ))
+            ilb_test.py -c $sched_mc; RC=$?
+			if [ $RC -eq 0 ]; then
+				tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+			else
+				if [ $sched_mc -eq 0 ]; then
+					tst_resm TPASS "ILB & workload is not in same package when sched_mc=0"
 				else
-					if [ $sched_mc -eq 0 ]; then
-						tst_resm TPASS "ILB & workload is not in same package when sched_mc=0"
-					else
-						tst_resm TFAIL "ILB did not run in same package"
-					fi
+					tst_resm TFAIL "ILB did not run in same package"
 				fi
-			done
+			fi
 			if [ $hyper_threaded -eq $YES ]; then
 				for sched_smt in `seq 0 $max_sched_smt`; do
-					for work_load in ${work_loads_list}; do
-						: $(( TST_COUNT += 1 ))
-						ilb_test.py -c $sched_mc -t sched_smt -w $work_load; RC=$?
- 						if [ $RC -eq 0 ]; then
-							tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+					: $(( TST_COUNT += 1 ))
+					ilb_test.py -c $sched_mc -t sched_smt; RC=$?
+ 					if [ $RC -eq 0 ]; then
+						tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+					else
+						if [ $sched_mc -eq 0 -a $sched_smt -eq 0 ]; then
+							tst_resm TPASS "ILB & workload is not in same package when\
+sched_mc & sched_smt is 0"
 						else
-							if [ $sched_mc -eq 0 ]; then
-								tst_resm TPASS "ILB & workload is not in same package when sched_mc=0"
-							else
-								tst_resm TFAIL "ILB did not run in same package"    
-							fi
+							tst_resm TFAIL "ILB did not run in same package"    
 						fi
-					done
+					fi
 				done
 			fi
 		done
 	fi
-	if [ $multi_socket -eq $YES -a $hyper_threaded -eq $YES -a $multi_core -eq $YES ]; then
-		for sched_smt in `seq 0 $max_sched_smt`; do
-			for work_load in ${work_loads_list}; do
-				: $(( TST_COUNT += 1 ))
-				ilb_test.py -t $sched_smt -w $work_load; RC=$?
-				if [ $RC -eq 0 ]; then
-					tst_resm TPASS "ILB & workload not load not in same package for sched_smt=$sched_smt"
-				else
-					if [ $sched_smt -eq 0 ]; then
-						tst_resm TPASS "Its oky if ILB is not in same package when sched_smt=0"
-					else
-						tst_resm TFAIL "ILB did not run in same package"
-					fi
-				fi
-			done
-		done
-	fi
 fi
 
 exit $RC

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#7 lore raw

PATCH 5/6 Modified library functions based on review comments

In reply to Poornima Nayak
testcases/kernel/power_management/pm_include.sh +47 -127
diff -uprN ltp-full-20090831/testcases/kernel/power_management/pm_include.sh ltp-full-20090831_patched/testcases/kernel/power_management/pm_include.sh
@@ -71,7 +71,7 @@ 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':'`
-	[ $siblins > $cpu_cores ]; return $?
+	[ $siblings > $cpu_cores ]; return $?
 }
 
 check_input() {
@@ -146,152 +146,74 @@ get_valid_input() {
 	esac
 }
 		
-check_supp_wkld() {
-	sched_mcsmt=$1
-	work_load=$2
-
-	case "$sched_mcsmt" in
-		1) [ "$work_load" == "ebizzy" ]; return $?
-			;;
-		2) [ "$work_load" == "ebizzy" -o "$work_load" == "kernbench" ]; return $?
-            ;;
-		*) 
-               return 1
-			;;
-	esac
-}
-
-analyze_wrt_workload_hyperthreaded() {
-	sched_mc=$1
-    work_load=$2
-    pass_count=$3
-    sched_smt=$4
-
-	if [ $sched_mc -gt $sched_smt ]; then
-		check_supp_wkld $sched_mc $work_load; valid_workload=$?
-	else
-		check_supp_wkld $sched_smt $work_load; valid_workload=$?
-	fi
-
-	case "$valid_workload" in
-	0)
-		if [ $pass_count -lt 5 ]; then
-			RC=1
-			tst_resm TFAIL "Consolidation at package level failed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt for workload=$work_load"
-		else
-			tst_resm TPASS "Consolidation at package level passed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt & workload=$work_load"
-		fi ;;
-	1)
-		if [ $pass_count -lt 5 ]; then
-			tst_resm TPASS "Consolidation at package level failed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
-		else
-			RC=1
-			tst_resm TFAIL "Consolidation at package level passed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
-		fi ;;
-        esac
-}
-
-analyze_wrt_wkld() {
-	sched_mc=$1
-    work_load=$2
-    pass_count=$3
-	sched_smt=$4
-
-	check_supp_wkld $sched_mc $work_load; valid_workload=$?
-	if [ $hyper_threaded -eq $YES ]; then
-		analyze_wrt_workload_hyperthreaded $sched_mc $work_load $pass_count\
-		 $sched_smt 
-	else
-		case "$valid_workload" in
-		0)
-			if [ "$pass_count" -lt 5 ]; then
-				RC=1
-				tst_resm TFAIL "cpu consolidation failed for \
-sched_mc=$sched_mc for workload=$work_load"
-			else
-				tst_resm TPASS "cpu consolidation passed for \
-sched_mc=$sched_mc for workload=$work_load"
-			fi ;;
-		1)
-			if [ "$pass_count" -lt 5 ]; then
-				tst_resm TPASS "cpu consolidation failed for \
-unsupported workload $work_load when sched_mc=$sched_mc"
-            else
-				RC=1
-				tst_resm TFAIL "cpu consolidation passed for \
-unsupported workload $work_load when sched_mc=$sched_mc"
-            fi ;;
-        esac
-	fi
-}
-
 analyze_result_hyperthreaded() {
 	sched_mc=$1
-    work_load=$2
     pass_count=$3
     sched_smt=$4
 
-	echo "sched_mc =$sched_mc  work-load=$work_load  pass_count=$pass_count  sched_smt=$sched_smt"
 	case "$sched_mc" in
 	0)
-		if [ $sched_smt ]; then
-			case "$sched_smt" in
-			0)
-				if [ "$pass_count" -lt 5 ]; then
-					tst_resm TPASS "cpu consolidation failed for sched_mc=\
-$sched_mc & sched_smt=$sched_smt for workload=$work_load"
-				else
-					RC=1
-				tst_resm TFAIL "cpu consolidation passed for sched_mc=\
-$sched_mc & sched_smt=$sched_smt for workload=$work_load"
-				fi
-				;;
-			*)
-				analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
-				;;
-			esac
-		else
+		case "$sched_smt" in
+		0)
 			if [ $pass_count -lt 5 ]; then
 				tst_resm TPASS "cpu consolidation failed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc & sched_smt=$sched_smt"
 			else
 				RC=1
 				tst_resm TFAIL "cpu consolidation passed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc & sched_smt=$sched_smt"
 			fi
-		fi
-		;;
+			;;
+		*)
+           	if [ $pass_count -lt 5 ]; then
+               	tst_resm TFAIL "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+           	else
+				RC=1
+				tst_resm TPASS "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+			fi
+			;;
+		esac ;;
 	*)
-			analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
+		if [ $pass_count -lt 5 ]; then
+			tst_resm TFAIL "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+		else
+			RC=1
+			tst_resm TPASS "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+		fi
 		;;
 	esac
 }
 
 analyze_package_consolidation_result() {
 	sched_mc=$1
-    work_load=$2
     pass_count=$3
 	sched_smt=$4
 
-	if [ $hyper_threaded -eq $YES ]; then
-		analyze_result_hyperthreaded $sched_mc $work_load $pass_count $sched_smt
+	if [ $hyper_threaded -eq $YES -a $sched_smt ]; then
+		analyze_result_hyperthreaded $sched_mc $pass_count $sched_smt
 	else
 		case "$sched_mc" in
 	    0)
     	    if [ $pass_count -lt 5 ]; then
         	    tst_resm TPASS "cpu consolidation failed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc"
         	else
 				RC=1
             	tst_resm TFAIL "cpu consolidation passed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc"
         	fi ;;
     	*)
-        	analyze_wrt_wkld $sched_mc $work_load $pass_count
+			if [ $pass_count -lt 5 ]; then
+				tst_resm TFAIL "Consolidation at package level failed for \
+sched_mc=$sched_mc & sched_smt=$sched_smt"
+			else
+				tst_resm TPASS "Consolidation at package level passed for \
+sched_mc=$sched_mc & sched_smt=$sched_smt"
+			fi	
         	;;
     	esac
 	fi
@@ -299,27 +221,25 @@ $sched_mc for workload=$work_load"
 
 analyze_core_consolidation_result() {
 	sched_smt=$1
-	work_load=$2
 	pass_count=$3
 
-	case "$valid_workload" in
+	case "$sched_smt" in
 	0)
 		if [ $pass_count -lt 5 ]; then
+			tst_resm TPASS "Consolidation at core level failed \
+when sched_smt=$sched_smt"
+		else
+			tst_resm TFAIL "Consolidation at core level passed for \
+sched_smt=$sched_smt"
+		fi ;;	
+	*)
+		if [ $pass_count -lt 5 ]; then
 			RC=1
 			tst_resm TFAIL "Consolidation at core level failed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt for workload=$work_load"
+sched_smt=$sched_smt"
 		else
 			tst_resm TPASS "Consolidation at core level passed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt & workload=$work_load"
-		fi ;;
-	1)
-		if [ $pass_count -lt 5 ]; then
-			tst_resm TPASS "Consolidation at core level failed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
-		else
-			RC=1
-			tst_resm TFAIL "Consolidation at core level passed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
+sched_smt=$sched_smt"
 		fi ;;
 	esac
 }

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#9 lore raw

PATCH 6/6 Modified python functions based on requirement for new testcase

In reply to Poornima Nayak

Fixed some issues that affect verification code of new test scenarios.

testcases/kernel/power_management/lib/sched_mc.py +76 -42
diff -uprN ltp-full-20090831/testcases/kernel/power_management/lib/sched_mc.py ltp-full-20090831_patched/testcases/kernel/power_management/lib/sched_mc.py
@@ -21,6 +21,7 @@ cpu_count = 0
 socket_count = 0
 cpu1_max_intr = 0
 cpu2_max_intr = 0
+intr_stat_timer_0 = []
 
 def clear_dmesg():
     '''
@@ -177,6 +178,7 @@ def get_proc_loc_count(loc_stats):
                 for i in range(0, cpu_count):
                     # To skip LOC
                     loc_stats.append(data[i+1])
+                    print data[i+1]
         file_procstat.close()
     except Exception, details:
         print "Could not read interrupt statistics", details
@@ -216,12 +218,7 @@ def set_timer_migration_interface(value)
         print "Could not set timer_migration to ", value, e
         sys.exit(1)
 
-def start_cyclictest():
-    ''' Trigger cyclictest in background to increase
-        timer interrupts
-    '''
-    
-def trigger_ebizzy (stress, duration, background, pinned):
+def trigger_ebizzy (sched_smt, stress, duration, background, pinned):
     ''' Triggers ebizzy workload for sched_mc=1
         testing
     '''
@@ -230,8 +227,6 @@ def trigger_ebizzy (stress, duration, ba
             threads = get_hyper_thread_count()
         if stress == "partial":
             threads = cpu_count / socket_count
-            if is_hyper_threaded():
-                threads = threads / get_hyper_thread_count()
         if stress == "full":
 	    threads = cpu_count
         if stress == "single_job":
@@ -255,24 +250,30 @@ def trigger_ebizzy (stress, duration, ba
         if workload_dir != "":
             new_path = os.path.join(path,"%s" % workload_dir)
             get_proc_data(stats_start)
+            get_proc_loc_count(intr_start)
             try:
                 os.chdir(new_path)
                 if background == "yes":
-                    succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &' % (threads, duration))
+                    succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &'
+                        % (threads, duration))
                 else:
                     if pinned == "yes":
-                        succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null' % (cpu_count -1, threads, duration))
+                        succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null' 
+                            % (cpu_count -1, threads, duration))
                     else:
-                        succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' % (threads, duration))
+                        succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' 
+                            % (threads, duration))
          
                 if succ == 0: 
                     print "INFO: ebizzy workload triggerd"
                     os.chdir(olddir)
-                    get_proc_data(stats_stop)
+                    #Commented bcoz it doesnt make sense to capture it when workload triggered 
+                    #in background
+                    #get_proc_loc_count(intr_stop)
+                    #get_proc_data(stats_stop)
 		else:
                     print "INFO: ebizzy workload triggerd failed"
                     os.chdir(olddir)
-                    get_proc_data(stats_stop)
                     sys.exit(1)
             except Exception, details:
                 print "Ebizzy workload trigger failed ", details
@@ -281,7 +282,7 @@ def trigger_ebizzy (stress, duration, ba
         print "Ebizzy workload trigger failed ", details
         sys.exit(1)   
 
-def trigger_kernbench (stress, background, pinned):
+def trigger_kernbench (sched_smt, stress, background, pinned):
     ''' Trigger load on system like kernbench.
         Copys existing copy of LTP into as LTP2 and then builds it
         with make -j
@@ -292,7 +293,7 @@ def trigger_kernbench (stress, backgroun
 	    threads = 2
         if stress == "partial":
 	    threads = cpu_count / socket_count
-            if is_hyper_threaded():
+            if is_hyper_threaded() and int(sched_smt) !=2:
                 threads = threads / get_hyper_thread_count()
         if stress == "full":
             threads = cpu_count
@@ -326,33 +327,40 @@ def trigger_kernbench (stress, backgroun
         if linux_source_dir != "":
             os.chdir(linux_source_dir)
         else:
-            print "INFO: Linux kernel source not found. Kernbench cannot be executed"
+            print "INFO: Linux kernel source not found in /root. Workload\
+               Kernbench cannot be executed"
 	    sys.exit(1)
   
         get_proc_data(stats_start)
         get_proc_loc_count(intr_start)
         if pinned == "yes":
-            os.system ( 'taskset -c %s %s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (cpu_count-1, benchmark_path, threads))
+            os.system ( 'taskset -c %s %s/kernbench -o %s -M -H -n 1 \
+                >/dev/null 2>&1' % (cpu_count-1, benchmark_path, threads))
         else:
-            os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (benchmark_path, threads))
+            if background == "yes":
+                os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1 &' \
+                    % (benchmark_path, threads))
+            else:
+                os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' \
+                    % (benchmark_path, threads))
         
         print "INFO: Workload kernbench triggerd"
         os.chdir(olddir)
-        get_proc_data(stats_stop)
-        get_proc_loc_count(intr_stop)
+        #get_proc_data(stats_stop)
+        #get_proc_loc_count(intr_stop)
     except Exception, details:
         print "Workload kernbench trigger failed ", details
         sys.exit(1)
    
-def trigger_workld(workload, stress, duration, background, pinned):
+def trigger_workld(sched_smt, workload, stress, duration, background, pinned):
     ''' Triggers workload passed as argument. Number of threads 
         triggered is based on stress value.
     '''
     try:
         if workload == "ebizzy":
-            trigger_ebizzy (stress, duration, background, pinned)
+            trigger_ebizzy (sched_smt, stress, duration, background, pinned)
         if workload == "kernbench":
-            trigger_kernbench (stress, background, pinned)
+            trigger_kernbench (sched_smt, stress, background, pinned)
     except Exception, details:
         print "INFO: Trigger workload failed", details
         sys.exit(1)
@@ -365,6 +373,8 @@ def generate_report():
     if (not os.path.exists('/procstat')):
         os.mkdir('/procstat')
 
+    get_proc_data(stats_stop)
+
     reportfile = open('/procstat/cpu-utilisation', 'a')
     debugfile = open('/procstat/cpu-utilisation.debug', 'a')
     for l in stats_stop:
@@ -438,18 +448,40 @@ def generate_report():
 def generate_loc_intr_report():
     ''' Generate interrupt report of CPU's
     '''
-    if (not os.path.exists('/procstat')):
-        os.mkdir('/procstat')
+    try:
+        if (not os.path.exists('/procstat')):
+            os.mkdir('/procstat')
 
-    reportfile = open('/procstat/cpu-loc_interrupts', 'a')
-    print >> reportfile, "=============================================================="
-    print >> reportfile, "                Local timer interrupt stats                   "
-    print >> reportfile, "=============================================================="
-    for i in range(0, cpu_count):
-        intr_stop[i] =  int(intr_stop[i]) - int(intr_start[i])
-        print >> reportfile, "CPU%s: %s" %(i, intr_stop[i])
-    print >> reportfile
-    reportfile.close()
+        get_proc_loc_count(intr_stop)
+
+        print "Before substracting"
+        for i in range(0, cpu_count):
+            print "CPU",i, intr_start[i], intr_stop[i]
+            reportfile = open('/procstat/cpu-loc_interrupts', 'a')
+            print >> reportfile, "=============================================="
+            print >> reportfile, "     Local timer interrupt stats              "
+            print >> reportfile, "=============================================="
+        for i in range(0, cpu_count):
+            intr_stop[i] =  int(intr_stop[i]) - int(intr_start[i])
+            print >> reportfile, "CPU%s: %s" %(i, intr_stop[i])
+        print >> reportfile
+        reportfile.close()
+    except Exception, details:
+        print "Generating reportfile failed: ", details
+        sys.exit(1)
+
+def record_loc_intr_count():
+    ''' Record Interrupt statistics when timer_migration
+        was disabled
+    '''
+    try:
+        global intr_start, intr_stop
+        for i in range(0, cpu_count):
+            intr_stat_timer_0.append(intr_stop[i]) 
+        intr_start = []
+        intr_stop = []
+    except Exception, details:
+        print "INFO: Record interrupt statistics when timer_migration=0",details 
 
 def expand_range(range_val):
     '''
@@ -519,7 +551,7 @@ def validate_cpugrp_map(cpu_group, sched
                                     if len(cpu_group) == 2 and \
                                         len(modi_cpu_grp) < len(cpu_group):
                                         print "INFO:CPUs utilized not in a core"
-                                        return 0                                        
+                                        return 1                                        
             print "INFO: CPUs utilized is not in same package or core"
             return(1)
 	else:
@@ -550,7 +582,8 @@ def verify_sched_domain_dmesg(sched_mc_l
                     if group_info.find("(") != -1:
                         openindex=group_info.index("(")
                         closeindex=group_info.index(")")
-                        group_info=group_info.replace(group_info[openindex:closeindex+1],"")
+                        group_info=group_info.replace\
+                            (group_info[openindex:closeindex+1],"")
 
                     subgroup = group_info.split()
                     for j in range(0, len(subgroup)):
@@ -586,19 +619,20 @@ def validate_cpu_consolidation(work_ld, 
                     if cpu_id[1] != '':
                         cpus_utilized.append(int(cpu_id[1]))
                 else:
-                    if stats_percentage[l][1] > 50:
+                    if stats_percentage[l][1] > 70:
                         cpu_id = stats_percentage[l][0].split("cpu")
                         if cpu_id[1] != '':
                             cpus_utilized.append(int(cpu_id[1]))
             else:
-                if stats_percentage[l][1] > 50:
+                if stats_percentage[l][1] > 70:
                     cpu_id = stats_percentage[l][0].split("cpu")
                     if cpu_id[1] != '':
                         cpus_utilized.append(int(cpu_id[1]))
                     cpus_utilized.sort()
         print "INFO: CPU's utilized ", cpus_utilized
 
-        status = validate_cpugrp_map(cpus_utilized, sched_mc_level, sched_smt_level)
+        status = validate_cpugrp_map(cpus_utilized, sched_mc_level, \
+            sched_smt_level)
         if status == 1:
             print "INFO: CPUs utilized is not in same package or core"
         return(status)
@@ -627,9 +661,9 @@ def get_cpuid_max_intr_count():
         for i in range(1, cpu_count):
             if i != cpu1_max_intr and i != cpu2_max_intr:
                 diff = second_highest - intr_stop[i]
-                ''' Threshold of difference has to be manipulated with multiple test'''
+                ''' Threshold of difference has to be manipulated '''
                 if diff < 10000:
-                    print "INFO: Difference in interrupt count is below threshold"
+                    print "INFO: Diff in interrupt count is below threshold"
                     return 1
         print "INFO: Interrupt count in other CPU's low as expected"
         return 0 
@@ -652,7 +686,7 @@ def validate_ilb (sched_mc_level, sched_
     except Exception, details:
         print "Exception in validate_ilb: ", details
         sys.exit(1)
-    
+
 def reset_schedmc():
     ''' Routine to reset sched_mc_power_savings to Zero level
     '''

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#10 lore raw

Re: [LTP] [Patch 6/6] Modified python functions based on requirement for new testcase

Quoted 3 lines · Poornima Nayak

Fixed some issues that affect verification code of new test scenarios.

Thanks.

Regards--
Subrata

Quoted 274 lines

diff -uprN ltp-full-20090831/testcases/kernel/power_management/lib/sched_mc.py ltp-full-20090831_patched/testcases/kernel/power_management/lib/sched_mc.py

testcases/kernel/power_management/lib/sched_mc.py +76 -43
@@ -21,6 +21,7 @@ cpu_count = 0
 socket_count = 0
 cpu1_max_intr = 0
 cpu2_max_intr = 0
+intr_stat_timer_0 = []
 
 def clear_dmesg():
     '''
@@ -177,6 +178,7 @@ def get_proc_loc_count(loc_stats):
                 for i in range(0, cpu_count):
                     # To skip LOC
                     loc_stats.append(data[i+1])
+                    print data[i+1]
         file_procstat.close()
     except Exception, details:
         print "Could not read interrupt statistics", details
@@ -216,12 +218,7 @@ def set_timer_migration_interface(value)
         print "Could not set timer_migration to ", value, e
         sys.exit(1)
 
-def start_cyclictest():
-    ''' Trigger cyclictest in background to increase
-        timer interrupts
-    '''
-    
-def trigger_ebizzy (stress, duration, background, pinned):
+def trigger_ebizzy (sched_smt, stress, duration, background, pinned):
     ''' Triggers ebizzy workload for sched_mc=1
         testing
     '''
@@ -230,8 +227,6 @@ def trigger_ebizzy (stress, duration, ba
             threads = get_hyper_thread_count()
         if stress == "partial":
             threads = cpu_count / socket_count
-            if is_hyper_threaded():
-                threads = threads / get_hyper_thread_count()
         if stress == "full":
 	    threads = cpu_count
         if stress == "single_job":
@@ -255,24 +250,30 @@ def trigger_ebizzy (stress, duration, ba
         if workload_dir != "":
             new_path = os.path.join(path,"%s" % workload_dir)
             get_proc_data(stats_start)
+            get_proc_loc_count(intr_start)
             try:
                 os.chdir(new_path)
                 if background == "yes":
-                    succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &' % (threads, duration))
+                    succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &'
+                        % (threads, duration))
                 else:
                     if pinned == "yes":
-                        succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null' % (cpu_count -1, threads, duration))
+                        succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null' 
+                            % (cpu_count -1, threads, duration))
                     else:
-                        succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' % (threads, duration))
+                        succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' 
+                            % (threads, duration))
 
                 if succ == 0: 
                     print "INFO: ebizzy workload triggerd"
                     os.chdir(olddir)
-                    get_proc_data(stats_stop)
+                    #Commented bcoz it doesnt make sense to capture it when workload triggered 
+                    #in background
+                    #get_proc_loc_count(intr_stop)
+                    #get_proc_data(stats_stop)
 		else:
                     print "INFO: ebizzy workload triggerd failed"
                     os.chdir(olddir)
-                    get_proc_data(stats_stop)
                     sys.exit(1)
             except Exception, details:
                 print "Ebizzy workload trigger failed ", details
@@ -281,7 +282,7 @@ def trigger_ebizzy (stress, duration, ba
         print "Ebizzy workload trigger failed ", details
         sys.exit(1)   
 
-def trigger_kernbench (stress, background, pinned):
+def trigger_kernbench (sched_smt, stress, background, pinned):
     ''' Trigger load on system like kernbench.
         Copys existing copy of LTP into as LTP2 and then builds it
         with make -j
@@ -292,7 +293,7 @@ def trigger_kernbench (stress, backgroun
 	    threads = 2
         if stress == "partial":
 	    threads = cpu_count / socket_count
-            if is_hyper_threaded():
+            if is_hyper_threaded() and int(sched_smt) !=2:
                 threads = threads / get_hyper_thread_count()
         if stress == "full":
             threads = cpu_count
@@ -326,33 +327,40 @@ def trigger_kernbench (stress, backgroun
         if linux_source_dir != "":
             os.chdir(linux_source_dir)
         else:
-            print "INFO: Linux kernel source not found. Kernbench cannot be executed"
+            print "INFO: Linux kernel source not found in /root. Workload\
+               Kernbench cannot be executed"
 	    sys.exit(1)
 
         get_proc_data(stats_start)
         get_proc_loc_count(intr_start)
         if pinned == "yes":
-            os.system ( 'taskset -c %s %s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (cpu_count-1, benchmark_path, threads))
+            os.system ( 'taskset -c %s %s/kernbench -o %s -M -H -n 1 \
+                >/dev/null 2>&1' % (cpu_count-1, benchmark_path, threads))
         else:
-            os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (benchmark_path, threads))
+            if background == "yes":
+                os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1 &' \
+                    % (benchmark_path, threads))
+            else:
+                os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' \
+                    % (benchmark_path, threads))
 
         print "INFO: Workload kernbench triggerd"
         os.chdir(olddir)
-        get_proc_data(stats_stop)
-        get_proc_loc_count(intr_stop)
+        #get_proc_data(stats_stop)
+        #get_proc_loc_count(intr_stop)
     except Exception, details:
         print "Workload kernbench trigger failed ", details
         sys.exit(1)
 
-def trigger_workld(workload, stress, duration, background, pinned):
+def trigger_workld(sched_smt, workload, stress, duration, background, pinned):
     ''' Triggers workload passed as argument. Number of threads 
         triggered is based on stress value.
     '''
     try:
         if workload == "ebizzy":
-            trigger_ebizzy (stress, duration, background, pinned)
+            trigger_ebizzy (sched_smt, stress, duration, background, pinned)
         if workload == "kernbench":
-            trigger_kernbench (stress, background, pinned)
+            trigger_kernbench (sched_smt, stress, background, pinned)
     except Exception, details:
         print "INFO: Trigger workload failed", details
         sys.exit(1)
@@ -365,6 +373,8 @@ def generate_report():
     if (not os.path.exists('/procstat')):
         os.mkdir('/procstat')
 
+    get_proc_data(stats_stop)
+
     reportfile = open('/procstat/cpu-utilisation', 'a')
     debugfile = open('/procstat/cpu-utilisation.debug', 'a')
     for l in stats_stop:
@@ -438,18 +448,40 @@ def generate_report():
 def generate_loc_intr_report():
     ''' Generate interrupt report of CPU's
     '''
-    if (not os.path.exists('/procstat')):
-        os.mkdir('/procstat')
+    try:
+        if (not os.path.exists('/procstat')):
+            os.mkdir('/procstat')
 
-    reportfile = open('/procstat/cpu-loc_interrupts', 'a')
-    print >> reportfile, "=============================================================="
-    print >> reportfile, "                Local timer interrupt stats                   "
-    print >> reportfile, "=============================================================="
-    for i in range(0, cpu_count):
-        intr_stop[i] =  int(intr_stop[i]) - int(intr_start[i])
-        print >> reportfile, "CPU%s: %s" %(i, intr_stop[i])
-    print >> reportfile
-    reportfile.close()
+        get_proc_loc_count(intr_stop)
+
+        print "Before substracting"
+        for i in range(0, cpu_count):
+            print "CPU",i, intr_start[i], intr_stop[i]
+            reportfile = open('/procstat/cpu-loc_interrupts', 'a')
+            print >> reportfile, "=============================================="
+            print >> reportfile, "     Local timer interrupt stats              "
+            print >> reportfile, "=============================================="
+        for i in range(0, cpu_count):
+            intr_stop[i] =  int(intr_stop[i]) - int(intr_start[i])
+            print >> reportfile, "CPU%s: %s" %(i, intr_stop[i])
+        print >> reportfile
+        reportfile.close()
+    except Exception, details:
+        print "Generating reportfile failed: ", details
+        sys.exit(1)
+
+def record_loc_intr_count():
+    ''' Record Interrupt statistics when timer_migration
+        was disabled
+    '''
+    try:
+        global intr_start, intr_stop
+        for i in range(0, cpu_count):
+            intr_stat_timer_0.append(intr_stop[i]) 
+        intr_start = []
+        intr_stop = []
+    except Exception, details:
+        print "INFO: Record interrupt statistics when timer_migration=0",details 
 
 def expand_range(range_val):
     '''
@@ -519,7 +551,7 @@ def validate_cpugrp_map(cpu_group, sched
                                     if len(cpu_group) == 2 and \
                                         len(modi_cpu_grp) < len(cpu_group):
                                         print "INFO:CPUs utilized not in a core"
-                                        return 0                                        
+                                        return 1                                        
             print "INFO: CPUs utilized is not in same package or core"
             return(1)
 	else:
@@ -550,7 +582,8 @@ def verify_sched_domain_dmesg(sched_mc_l
                     if group_info.find("(") != -1:
                         openindex=group_info.index("(")
                         closeindex=group_info.index(")")
-                        group_info=group_info.replace(group_info[openindex:closeindex+1],"")
+                        group_info=group_info.replace\
+                            (group_info[openindex:closeindex+1],"")
 
                     subgroup = group_info.split()
                     for j in range(0, len(subgroup)):
@@ -586,19 +619,20 @@ def validate_cpu_consolidation(work_ld, 
                     if cpu_id[1] != '':
                         cpus_utilized.append(int(cpu_id[1]))
                 else:
-                    if stats_percentage[l][1] > 50:
+                    if stats_percentage[l][1] > 70:
                         cpu_id = stats_percentage[l][0].split("cpu")
                         if cpu_id[1] != '':
                             cpus_utilized.append(int(cpu_id[1]))
             else:
-                if stats_percentage[l][1] > 50:
+                if stats_percentage[l][1] > 70:
                     cpu_id = stats_percentage[l][0].split("cpu")
                     if cpu_id[1] != '':
                         cpus_utilized.append(int(cpu_id[1]))
                     cpus_utilized.sort()
         print "INFO: CPU's utilized ", cpus_utilized
 
-        status = validate_cpugrp_map(cpus_utilized, sched_mc_level, sched_smt_level)
+        status = validate_cpugrp_map(cpus_utilized, sched_mc_level, \
+            sched_smt_level)
         if status == 1:
             print "INFO: CPUs utilized is not in same package or core"
         return(status)
@@ -627,9 +661,9 @@ def get_cpuid_max_intr_count():
         for i in range(1, cpu_count):
             if i != cpu1_max_intr and i != cpu2_max_intr:
                 diff = second_highest - intr_stop[i]
-                ''' Threshold of difference has to be manipulated with multiple test'''
+                ''' Threshold of difference has to be manipulated '''
                 if diff < 10000:
-                    print "INFO: Difference in interrupt count is below threshold"
+                    print "INFO: Diff in interrupt count is below threshold"
                     return 1
         print "INFO: Interrupt count in other CPU's low as expected"
         return 0 
@@ -652,7 +686,7 @@ def validate_ilb (sched_mc_level, sched_
     except Exception, details:
         print "Exception in validate_ilb: ", details
         sys.exit(1)
-    
+
 def reset_schedmc():
     ''' Routine to reset sched_mc_power_savings to Zero level
     '''
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry&reg; Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#8 lore raw

Re: [LTP] [Patch 5/6] Modified library functions based on review comments

In reply to Poornima Nayak

No Signed-off-by: here.

Quoted 242 lines · Poornima Nayak

diff -uprN ltp-full-20090831/testcases/kernel/power_management/pm_include.sh ltp-full-20090831_patched/testcases/kernel/power_management/pm_include.sh

testcases/kernel/power_management/pm_include.sh +47 -128
@@ -71,7 +71,7 @@ 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':'`
-	[ $siblins > $cpu_cores ]; return $?
+	[ $siblings > $cpu_cores ]; return $?
 }
 
 check_input() {
@@ -146,152 +146,74 @@ get_valid_input() {
 	esac
 }
 
-check_supp_wkld() {
-	sched_mcsmt=$1
-	work_load=$2
-
-	case "$sched_mcsmt" in
-		1) [ "$work_load" == "ebizzy" ]; return $?
-			;;
-		2) [ "$work_load" == "ebizzy" -o "$work_load" == "kernbench" ]; return $?
-            ;;
-		*) 
-               return 1
-			;;
-	esac
-}
-
-analyze_wrt_workload_hyperthreaded() {
-	sched_mc=$1
-    work_load=$2
-    pass_count=$3
-    sched_smt=$4
-
-	if [ $sched_mc -gt $sched_smt ]; then
-		check_supp_wkld $sched_mc $work_load; valid_workload=$?
-	else
-		check_supp_wkld $sched_smt $work_load; valid_workload=$?
-	fi
-
-	case "$valid_workload" in
-	0)
-		if [ $pass_count -lt 5 ]; then
-			RC=1
-			tst_resm TFAIL "Consolidation at package level failed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt for workload=$work_load"
-		else
-			tst_resm TPASS "Consolidation at package level passed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt & workload=$work_load"
-		fi ;;
-	1)
-		if [ $pass_count -lt 5 ]; then
-			tst_resm TPASS "Consolidation at package level failed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
-		else
-			RC=1
-			tst_resm TFAIL "Consolidation at package level passed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
-		fi ;;
-        esac
-}
-
-analyze_wrt_wkld() {
-	sched_mc=$1
-    work_load=$2
-    pass_count=$3
-	sched_smt=$4
-
-	check_supp_wkld $sched_mc $work_load; valid_workload=$?
-	if [ $hyper_threaded -eq $YES ]; then
-		analyze_wrt_workload_hyperthreaded $sched_mc $work_load $pass_count\
-		 $sched_smt 
-	else
-		case "$valid_workload" in
-		0)
-			if [ "$pass_count" -lt 5 ]; then
-				RC=1
-				tst_resm TFAIL "cpu consolidation failed for \
-sched_mc=$sched_mc for workload=$work_load"
-			else
-				tst_resm TPASS "cpu consolidation passed for \
-sched_mc=$sched_mc for workload=$work_load"
-			fi ;;
-		1)
-			if [ "$pass_count" -lt 5 ]; then
-				tst_resm TPASS "cpu consolidation failed for \
-unsupported workload $work_load when sched_mc=$sched_mc"
-            else
-				RC=1
-				tst_resm TFAIL "cpu consolidation passed for \
-unsupported workload $work_load when sched_mc=$sched_mc"
-            fi ;;
-        esac
-	fi
-}
-
 analyze_result_hyperthreaded() {
 	sched_mc=$1
-    work_load=$2
     pass_count=$3
     sched_smt=$4
 
-	echo "sched_mc =$sched_mc  work-load=$work_load  pass_count=$pass_count  sched_smt=$sched_smt"
 	case "$sched_mc" in
 	0)
-		if [ $sched_smt ]; then
-			case "$sched_smt" in
-			0)
-				if [ "$pass_count" -lt 5 ]; then
-					tst_resm TPASS "cpu consolidation failed for sched_mc=\
-$sched_mc & sched_smt=$sched_smt for workload=$work_load"
-				else
-					RC=1
-				tst_resm TFAIL "cpu consolidation passed for sched_mc=\
-$sched_mc & sched_smt=$sched_smt for workload=$work_load"
-				fi
-				;;
-			*)
-				analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
-				;;
-			esac
-		else
+		case "$sched_smt" in
+		0)
 			if [ $pass_count -lt 5 ]; then
 				tst_resm TPASS "cpu consolidation failed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc & sched_smt=$sched_smt"
 			else
 				RC=1
 				tst_resm TFAIL "cpu consolidation passed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc & sched_smt=$sched_smt"
 			fi
-		fi
-		;;
+			;;
+		*)
+           	if [ $pass_count -lt 5 ]; then
+               	tst_resm TFAIL "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+           	else
+				RC=1
+				tst_resm TPASS "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+			fi
+			;;
+		esac ;;
 	*)
-			analyze_wrt_wkld $sched_mc $work_load $pass_count $sched_smt
+		if [ $pass_count -lt 5 ]; then
+			tst_resm TFAIL "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+		else
+			RC=1
+			tst_resm TPASS "cpu consolidation for sched_mc=\
+$sched_mc & sched_smt=$sched_smt"
+		fi
 		;;
 	esac
 }
 
 analyze_package_consolidation_result() {
 	sched_mc=$1
-    work_load=$2
     pass_count=$3
 	sched_smt=$4
 
-	if [ $hyper_threaded -eq $YES ]; then
-		analyze_result_hyperthreaded $sched_mc $work_load $pass_count $sched_smt
+	if [ $hyper_threaded -eq $YES -a $sched_smt ]; then
+		analyze_result_hyperthreaded $sched_mc $pass_count $sched_smt
 	else
 		case "$sched_mc" in
 	    0)
     	    if [ $pass_count -lt 5 ]; then
         	    tst_resm TPASS "cpu consolidation failed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc"
         	else
 				RC=1
             	tst_resm TFAIL "cpu consolidation passed for sched_mc=\
-$sched_mc for workload=$work_load"
+$sched_mc"
         	fi ;;
     	*)
-        	analyze_wrt_wkld $sched_mc $work_load $pass_count
+			if [ $pass_count -lt 5 ]; then
+				tst_resm TFAIL "Consolidation at package level failed for \
+sched_mc=$sched_mc & sched_smt=$sched_smt"
+			else
+				tst_resm TPASS "Consolidation at package level passed for \
+sched_mc=$sched_mc & sched_smt=$sched_smt"
+			fi	
         	;;
     	esac
 	fi
@@ -299,27 +221,25 @@ $sched_mc for workload=$work_load"
 
 analyze_core_consolidation_result() {
 	sched_smt=$1
-	work_load=$2
 	pass_count=$3
 
-	case "$valid_workload" in
+	case "$sched_smt" in
 	0)
 		if [ $pass_count -lt 5 ]; then
+			tst_resm TPASS "Consolidation at core level failed \
+when sched_smt=$sched_smt"
+		else
+			tst_resm TFAIL "Consolidation at core level passed for \
+sched_smt=$sched_smt"
+		fi ;;	
+	*)
+		if [ $pass_count -lt 5 ]; then
 			RC=1
 			tst_resm TFAIL "Consolidation at core level failed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt for workload=$work_load"
+sched_smt=$sched_smt"
 		else
 			tst_resm TPASS "Consolidation at core level passed for \
-sched_mc=$sched_mc, sched_smt=$sched_smt & workload=$work_load"
-		fi ;;
-	1)
-		if [ $pass_count -lt 5 ]; then
-			tst_resm TPASS "Consolidation at core level failed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
-		else
-			RC=1
-			tst_resm TFAIL "Consolidation at core level passed for \
-unsupported workload $work_load when sched_mc=$sched_mc & sched_smt=$sched_smt"
+sched_smt=$sched_smt"
 		fi ;;
 	esac
 }
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry&reg; Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#6 lore raw

Re: [LTP] [Patch 4/6] To include Additional 5 new test cases

In reply to Poornima Nayak
Quoted 4 lines · Poornima Nayak

Additional 5 new testcases to test cpu consolidation resets when sched_smt &(/) sched_mc is reset to zero.

Thanks.

Regards--
Subrata

Quoted 268 lines

diff -uprN ltp-full-20090831/testcases/kernel/power_management/runpwtests.sh ltp-full-20090831_patched/testcases/kernel/power_management/runpwtests.sh

testcases/kernel/power_management/runpwtests.sh +123 -85
@@ -170,6 +170,7 @@ if [ $? -ne 0 ] ; then
 test cannot run"
 else
 	get_sched_values sched_mc; max_sched_mc=$?
+    echo "max 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=$?
@@ -187,15 +188,17 @@ else
 fi
 
 : $(( TST_COUNT+=1))
+check_kv_arch "timer_migration"; supp=$?
 if [ -f /proc/sys/kernel/timer_migration ]; then
-	if test_timer_migration.sh; then
-        tst_resm TPASS "Timer Migration interface test"
-    else
-        RC=$?
-        tst_resm TFAIL "Timer migration interface test"
-    fi
+	if [ $supp -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
-	check_kv_arch "timer_migration"; supp=$? 
 	if [ $supp -eq $YES ]; then
 		RC=$?
 		tst_resm TFAIL "Timer migration interface missing"
@@ -204,52 +207,45 @@ else
 	fi
 fi
 
-: $(( TST_COUNT+=1))	
-if check_cpufreq_sysfs_files.sh; then
-        tst_resm TPASS "CPUFREQ sysfs tests"
-    else
-        RC=$?
-        tst_resm TFAIL "CPUFREQ sysfs tests "
-    fi
-
 if [ $# -gt 0 -a "$1" = "-exclusive" ]; then 
 	# Test CPU consolidation 
 	if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
-		work_loads_list="ebizzy kernbench"
 		for sched_mc in `seq 0 $max_sched_mc`; do
-			for work_load in ${work_loads_list}
-           	do
-				: $(( TST_COUNT += 1 ))
-				sched_mc_pass_cnt=0
-				for repeat_test in `seq 1  10`; do
-					#Testcase to validate CPU consolidation for sched_mc
-					if cpu_consolidation.py -c $sched_mc -w $work_load ; then
-						: $(( sched_mc_pass_cnt += 1 ))
-					fi
-				done
-				analyze_package_consolidation_result $sched_mc $work_load $sched_mc_pass_cnt	
-			done	
+			: $(( TST_COUNT += 1 ))
+			sched_mc_pass_cnt=0
+			if [ $sched_mc -eq 2 ]; then
+				work_load="kernbench"
+			else
+				work_load="ebizzy"
+			fi
+			for repeat_test in `seq 1  10`; do
+				#Testcase to validate CPU consolidation for sched_mc
+				if cpu_consolidation.py -c $sched_mc -w $work_load ; then
+					: $(( sched_mc_pass_cnt += 1 ))
+				fi
+			done
+			analyze_package_consolidation_result $sched_mc $sched_mc_pass_cnt	
+			
 			if [ $hyper_threaded -eq $YES ]; then
 				for sched_smt in `seq 0 $max_sched_smt`; do
-					for work_load in ${work_loads_list}; do
-                   				: $(( TST_COUNT += 1 ))
-						sched_mc_smt_pass_cnt=0
-						for repeat_test in `seq 1  10`; do
-							# Testcase to validate CPU consolidation for
-							# for sched_mc & sched_smt with stress=50%
-							if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
-								: $(( sched_mc_smt_pass_cnt += 1 ))
-							fi
-							echo "sched_mc_smt_pass_cnt = $sched_mc_smt_pass_cnt"
-						done
-						analyze_package_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt
+					: $(( TST_COUNT += 1 ))
+					sched_mc_smt_pass_cnt=0
+					for repeat_test in `seq 1  10`; do
+						# Testcase to validate CPU consolidation for
+						# for sched_mc & sched_smt with stress=50%
+						if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
+							: $(( sched_mc_smt_pass_cnt += 1 ))
+						fi
 					done
+					analyze_package_consolidation_result $sched_mc $sched_mc_smt_pass_cnt $sched_smt
 				done
 			fi
 		done
+
 	fi
-	if [ $hyper_threaded -eq $YES ]; then
+	if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES ]; then
 		#Testcase to validate consolidation at core level
+		work_load="ebizzy"
 		sched_smt_pass_cnt=0
 		: $(( TST_COUNT += 1 ))
 		stress="thread"
@@ -259,61 +255,104 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; 
 			fi
 		done
 		analyze_core_consolidation_result $sched_smt $work_load $sched_smt_pass_cnt
+
+		# 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 ))
+		if cpu_consolidation.py -vt; then
+			tst_resm TPASS "CPU consolidation test by varying sched_smt"
+		else
+			tst_resm TFAIL "CPU consolidation test by varying sched_smt"
+		fi
 	fi
-        # Verify ILB runs in same package as workload
-        if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
-		work_loads_list="ebizzy kernbench"	
+
+	# Verify threads consolidation stops when sched_mc &(/) sched_smt is disabled
+    if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
+		: $(( TST_COUNT += 1 ))
+		# Vary sched_mc from 1 to 0 when workload is running and ensure that
+		# tasks do not consolidate to single package when sched_mc is set to 0
+		if cpu_consolidation.py -v -c 1; then
+            tst_resm TPASS "CPU consolidation test by varying sched_mc 1 to 0"
+        else
+            tst_resm TFAIL "CPU consolidation test by varying sched_mc 1 to 0"
+        fi
+
+		# Vary sched_mc from 2 to 0 when workload is running and ensure that
+        # tasks do not consolidate to single package when sched_mc is set to 0
+		: $(( TST_COUNT += 1 ))
+		if cpu_consolidation.py -v -c 2; then
+			tst_resm TPASS "CPU consolidation test by varying sched_mc 2 to 0"
+		else
+			tst_resm TFAIL "CPU consolidation test by varying sched_mc 2 to 0"
+		fi
+
+		if [ $hyper_threaded -eq $YES ]; then
+			# Vary sched_mc & sched_smt from 1 to 0 & 2 to 0 when workload is running and ensure that
+            # tasks do not consolidate to single package when sched_mc is set to 0
+            : $(( TST_COUNT += 1 ))
+			if cpu_consolidation.py -v -c 1 -t 1; then
+				tst_resm TPASS "CPU consolidation test by varying sched_mc \
+& sched_smt from 1 to 0"
+			else
+				tst_resm TFAIL "CPU consolidation test by varying sched_mc \
+& sched_smt from 1 to 0"
+			fi
+
+			: $(( TST_COUNT += 1 ))
+			if cpu_consolidation.py -v -c 2 -t 2; then
+				tst_resm TPASS "CPU consolidation test by varying sched_mc \
+ & sched_smt from 2 to 0"
+			else
+				tst_resm TFAIL "CPU consolidation test by varying sched_mc \
+ & sched_smt from 2 to 0"
+			fi
+		fi
+	fi
+
+    # Verify threads consolidation stops when is disabled in HT systems
+	if [ $hyper_threaded -eq $YES -a $multi_socket -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 ))
+		if cpu_consolidation.py -v -t 1; then
+			tst_resm TPASS "CPU consolidation test by varying sched_smt 1 to 0"
+		else
+			tst_resm TFAIL "CPU consolidation test by varying sched_smt 1 to 0"
+		fi
+	fi
+
+	# Verify ILB runs in same package as workload
+    if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then
 		for sched_mc in `seq 0 $max_sched_mc`; do
-			for work_load in ${work_loads_list}
-			do
-				: $(( TST_COUNT += 1 ))
-                                ilb_test.py -c $sched_mc -w $work_load; RC=$?
-				if [ $RC -eq 0 ]; then
-					tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+			: $(( TST_COUNT += 1 ))
+            ilb_test.py -c $sched_mc; RC=$?
+			if [ $RC -eq 0 ]; then
+				tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+			else
+				if [ $sched_mc -eq 0 ]; then
+					tst_resm TPASS "ILB & workload is not in same package when sched_mc=0"
 				else
-					if [ $sched_mc -eq 0 ]; then
-						tst_resm TPASS "ILB & workload is not in same package when sched_mc=0"
-					else
-						tst_resm TFAIL "ILB did not run in same package"
-					fi
+					tst_resm TFAIL "ILB did not run in same package"
 				fi
-			done
+			fi
 			if [ $hyper_threaded -eq $YES ]; then
 				for sched_smt in `seq 0 $max_sched_smt`; do
-					for work_load in ${work_loads_list}; do
-						: $(( TST_COUNT += 1 ))
-						ilb_test.py -c $sched_mc -t sched_smt -w $work_load; RC=$?
- 						if [ $RC -eq 0 ]; then
-							tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+					: $(( TST_COUNT += 1 ))
+					ilb_test.py -c $sched_mc -t sched_smt; RC=$?
+ 					if [ $RC -eq 0 ]; then
+						tst_resm TPASS "ILB & workload in same package for sched_mc=$sched_mc"
+					else
+						if [ $sched_mc -eq 0 -a $sched_smt -eq 0 ]; then
+							tst_resm TPASS "ILB & workload is not in same package when\
+sched_mc & sched_smt is 0"
 						else
-							if [ $sched_mc -eq 0 ]; then
-								tst_resm TPASS "ILB & workload is not in same package when sched_mc=0"
-							else
-								tst_resm TFAIL "ILB did not run in same package"    
-							fi
+							tst_resm TFAIL "ILB did not run in same package"    
 						fi
-					done
+					fi
 				done
 			fi
 		done
 	fi
-	if [ $multi_socket -eq $YES -a $hyper_threaded -eq $YES -a $multi_core -eq $YES ]; then
-		for sched_smt in `seq 0 $max_sched_smt`; do
-			for work_load in ${work_loads_list}; do
-				: $(( TST_COUNT += 1 ))
-				ilb_test.py -t $sched_smt -w $work_load; RC=$?
-				if [ $RC -eq 0 ]; then
-					tst_resm TPASS "ILB & workload not load not in same package for sched_smt=$sched_smt"
-				else
-					if [ $sched_smt -eq 0 ]; then
-						tst_resm TPASS "Its oky if ILB is not in same package when sched_smt=0"
-					else
-						tst_resm TFAIL "ILB did not run in same package"
-					fi
-				fi
-			done
-		done
-	fi
 fi
 
 exit $RC
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry&reg; Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw

Re: [LTP] [Patch 3/6] To incorporate changes in reusable function

In reply to Poornima Nayak
Quoted 4 lines · Poornima Nayak

ILB testcase uses trigger workload to pin a task to CPU. This patch is to incorporate the changes in the prototype of function testcase invokes to trigger workload.

Thanks.

Regards--
Subrata

Quoted 25 lines

diff -uprN ltp-full-20090831/testcases/kernel/power_management/ilb_test.py ltp-full-20090831_patched/testcases/kernel/power_management/ilb_test.py

testcases/kernel/power_management/ilb_test.py +4 -3
@@ -42,13 +42,15 @@ def main(argv=None):
         background="no"
         duration=60
         pinned="yes"
-        trigger_workld(options.work_ld, "single_job", duration, background, pinned)
+
+        trigger_workld(options.smt_level,options.work_ld, "single_job", duration, background, pinned)
         generate_loc_intr_report()
         status = validate_ilb(options.mc_level, options.smt_level)
         reset_schedmc()
         if is_hyper_threaded():
             reset_schedsmt()
-        return(status)        
+        return(status)     
+   
     except Exception, details:
         print "INFO: Idle Load Balancer test failed", details
         return(1)
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry&reg; Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#11 lore raw
In reply to Poornima Nayak
Quoted 4 lines · Poornima Nayak

CPU consolidation testcase modified to test when sched_mc &(/) sched_smt is set to Zero processes dont consolidate to single package or CPU.

Thanks.

Regards--
Subrata

Quoted 141 lines

diff -uprN ltp-full-20090831/testcases/kernel/power_management/cpu_consolidation.py ltp-full-20090831_patched/testcases/kernel/power_management/cpu_consolidation.py

testcases/kernel/power_management/cpu_consolidation.py +94 -19
@@ -5,6 +5,7 @@
 
 import os
 import sys
+import time
 LIB_DIR = "%s/testcases/kernel/power_management/lib" % os.environ['LTPROOT']
 sys.path.append(LIB_DIR)
 from optparse import OptionParser
@@ -22,9 +23,12 @@ def main(argv=None):
 
     usage = "-w"
     parser = OptionParser(usage)
-    parser.add_option("-c", "--mc_level", dest="mc_level",
+    parser.add_option("-v", "--variation_test", dest="vary_mc_smt",
+        default=False, action="store_true", help="Vary sched_mc & sched_smt. \
+            -c and -t inputs are initial value of sched_mc & sched_smt")
+    parser.add_option("-c", "--mc_value", dest="mc_value",
         default=0, help="Sched mc power saving value 0/1/2")
-    parser.add_option("-t", "--smt_level", dest="smt_level",
+    parser.add_option("-t", "--smt_value", dest="smt_value",
         default=0, help="Sched smt power saving value 0/1/2")
     parser.add_option("-w", "--workload", dest="work_ld",
         default="ebizzy", help="Workload can be ebizzy/kernbench")
@@ -35,22 +39,94 @@ def main(argv=None):
     try:
         count_num_cpu()
         count_num_sockets()
-        if is_multi_socket():
-            set_sched_mc_power(options.mc_level)
-        if is_hyper_threaded():
-            set_sched_smt_power(options.smt_level)
-        map_cpuid_pkgid()
-        print "INFO: Created table mapping cpu to package"
-        background="no"
-        duration=60
-        pinned ="no"
-        trigger_workld(options.work_ld, options.stress, duration, background, pinned)
-        generate_report()
-        status = validate_cpu_consolidation(options.work_ld,options.mc_level, options.smt_level)
-        reset_schedmc()
-        if is_hyper_threaded():
-            reset_schedsmt()
-        return(status)        
+        # User would set option -v / -vc / -vt to test cpu consolidation
+        # gets disabled when sched_mc &(/) sched_smt is disabled when
+        # workload is already running in the system 
+        if options.vary_mc_smt:
+
+            # Since same code is used for testing package consolidation and core
+            # consolidation is_multi_socket & is_hyper_threaded check is done
+            if is_multi_socket():
+                if options.mc_value:
+                    set_sched_mc_power(options.mc_value)
+                    mc_value=int(options.mc_value)
+                else:    
+                    set_sched_mc_power(1)
+                    mc_value=int(options.mc_value)
+            if is_hyper_threaded():
+                if options.smt_value:
+                    set_sched_smt_power(options.smt_value)
+                    smt_value=int(options.smt_value)
+                else:
+                    set_sched_smt_power(1)
+                    smt_value=1
+
+            #Generate arguments for trigger workload, run workload in background
+            map_cpuid_pkgid()
+            background="yes"
+            duration=360
+            pinned="no"
+            if int(options.mc_value) < 2:
+                trigger_ebizzy (smt_value, "partial", duration, background, pinned)
+                work_ld="ebizzy"
+                #Wait for 120 seconds and then validate cpu consolidation works
+                #When sched_mc & sched_smt is set
+                import time
+                time.sleep(120)
+            else:
+                #Wait for 120 seconds and then validate cpu consolidation works
+                #When sched_mc & sched_smt is set
+                trigger_kernbench (smt_value, "partial", background, pinned) 
+                work_ld="kernbench"
+                import time
+                time.sleep(240)
+
+            generate_report()
+            status = validate_cpu_consolidation(work_ld, mc_value, smt_value)
+            if status == 0:
+                print "INFO: Consolidation worked sched_smt &(/) sched_mc is set"
+                #Disable sched_smt & sched_mc interface values
+                if (options.vary_mc_smt and options.mc_value) and is_multi_socket():
+                    set_sched_mc_power(0)
+                    #Reset sched_smt bcoz when sched_smt is set process still
+                    #continue to consolidate
+                    if is_hyper_threaded():
+                        set_sched_smt_power(0)
+                if (options.vary_mc_smt and options.smt_value) and is_hyper_threaded():
+                    set_sched_smt_power(0)
+                time.sleep(120)
+                generate_report()
+                status = validate_cpu_consolidation(options.work_ld,options.mc_value, options.smt_value)
+                #CPU consolidation should fail as sched_mc &(/) sched_smt is disabled
+                if status == 1:
+                    return(0)
+                else:
+                    return(1)
+            else:
+                print "INFO: CPU consolidation failed when sched_mc &(/) \
+sched_smt was enabled. This is pre-requisite to proceed"
+                return(status)
+        else:           
+            #The else part of the code validates behaviour of sched_mc
+            # and sched_smt set to 0, 1 & 2
+            if is_multi_socket():
+                set_sched_mc_power(options.mc_value)
+            if is_hyper_threaded():
+                set_sched_smt_power(options.smt_value)
+                #Commented after observing changes in behaviour in 2.6.31-rc7
+                #stress="thread"
+            map_cpuid_pkgid()
+            print "INFO: Created table mapping cpu to package"
+            background="no"
+            duration=60
+            pinned ="no"
+            trigger_workld( options.smt_value, options.work_ld, options.stress, duration, background, pinned)
+            generate_report()
+            status = validate_cpu_consolidation(options.work_ld,options.mc_value, options.smt_value)
+            reset_schedmc()
+            if is_hyper_threaded():
+                reset_schedsmt()
+            return(status)        
     except Exception, details:
         print "INFO: CPU consolidation failed", details
         return(1)
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry&reg; Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

Re: [LTP] [Patch 2/6] To fix issue in get_sched_values

In reply to Poornima Nayak
Quoted 4 lines · Poornima Nayak

get_sched_values was returning 1 & 0 instead of max sched_mc & max sched_smt. This patch fixes the issue in the first version of this file.

Thanks.

Regards--
Subrata

Quoted 24 lines

diff -uprN ltp-full-20090831/testcases/kernel/power_management/get_sched_values.c ltp-full-20090831_patched/testcases/kernel/power_management/get_sched_values.c

testcases/kernel/power_management/get_sched_values.c +2 -9
@@ -40,14 +40,8 @@ int main(int argc, char **argv)
 	{
 		param = argv[1];
 		if (strcmp(param, "sched_mc")==0)
-			if (get_supp_sched_mc() == 0)
-				return 0;
-			else
-				return 1;
+			return (get_supp_sched_mc());
 		if (strcmp(param, "sched_smt")==0)
-                        if (get_supp_sched_smt() == 0)
-                                return 0;
-                        else
-                                return 1;
+                        return (get_supp_sched_smt());
 	}
 }
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry&reg; Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list