public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [Patch 1/6] To test consolidation resets when interfaces are set to 0
@ 2009-09-21  7:24 Poornima Nayak
  2009-09-21  7:24 ` [LTP] [Patch 2/6] To fix issue in get_sched_values Poornima Nayak
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Poornima Nayak @ 2009-09-21  7:24 UTC (permalink / raw)
  To: ltp-list, svaidy, ego, arun

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

Signed-off-by: poornima nayak <mpnayak@linux.vnet.ibm.com>

diff -uprN ltp-full-20090831/testcases/kernel/power_management/cpu_consolidation.py ltp-full-20090831_patched/testcases/kernel/power_management/cpu_consolidation.py
--- ltp-full-20090831/testcases/kernel/power_management/cpu_consolidation.py	2009-08-31 10:45:45.000000000 +0530
+++ ltp-full-20090831_patched/testcases/kernel/power_management/cpu_consolidation.py	2009-09-21 12:16:50.790630427 +0530
@@ -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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-09-21 16:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-21  7:24 [LTP] [Patch 1/6] To test consolidation resets when interfaces are set to 0 Poornima Nayak
2009-09-21  7:24 ` [LTP] [Patch 2/6] To fix issue in get_sched_values Poornima Nayak
2009-09-21 16:20   ` Subrata Modak
2009-09-21  7:25 ` [LTP] [Patch 3/6] To incorporate changes in reusable function Poornima Nayak
2009-09-21 16:20   ` Subrata Modak
2009-09-21  7:25 ` [LTP] [Patch 4/6] To include Additional 5 new test cases Poornima Nayak
2009-09-21 16:20   ` Subrata Modak
2009-09-21  7:25 ` [LTP] [Patch 5/6] Modified library functions based on review comments Poornima Nayak
2009-09-21 16:20   ` Subrata Modak
2009-09-21  7:25 ` [LTP] [Patch 6/6] Modified python functions based on requirement for new testcase Poornima Nayak
2009-09-21 16:20   ` Subrata Modak
2009-09-21 16:20 ` [LTP] [Patch 1/6] To test consolidation resets when interfaces are set to 0 Subrata Modak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox