Standard Switch: Drain the system before switching CPUs
authorJoel Hestness <hestness@cs.wisc.edu>
Thu, 13 Sep 2012 02:41:37 +0000 (21:41 -0500)
committerJoel Hestness <hestness@cs.wisc.edu>
Thu, 13 Sep 2012 02:41:37 +0000 (21:41 -0500)
When switching from an atomic CPU to any of the timing CPUs, a drain is
unnecessary since no events are scheduled in atomic mode. However, when
trying to switch CPUs starting with a timing CPU, there may be events
scheduled. This change ensures that all events are drained from the system
by calling m5.drain before switching CPUs.

configs/common/Simulation.py
src/python/m5/simulate.py

index 8e62bcbb69001c51095d1c20d19553666935726a..967f39b75b2af775f37a0e92ea99ae74d9644000 100644 (file)
@@ -453,6 +453,7 @@ def run(options, root, testsys, cpu_class):
         # manually.  You DON'T need to resume after just switching
         # CPUs if you haven't changed anything on the system level.
 
+        m5.doDrain(testsys)
         m5.changeToTiming(testsys)
         m5.switchCpus(switch_cpu_list)
         m5.resume(testsys)
@@ -469,7 +470,7 @@ def run(options, root, testsys, cpu_class):
             print "Switching CPUS @ tick %s" % (m5.curTick())
             print "Simulation ends instruction count:%d" % \
                     (testsys.switch_cpus_1[0].max_insts_any_thread)
-            m5.drain(testsys)
+            m5.doDrain(testsys)
             m5.switchCpus(switch_cpu_list1)
             m5.resume(testsys)
 
index 9cb647a6b0dd2ef4bb78b38dfeede61116cd3872..0f2a546c14b2c6068d9db0d89404339678717e32 100644 (file)
@@ -203,7 +203,6 @@ def changeToTiming(system):
               (type(system), objects.Root, objects.System)
 
     if system.getMemoryMode() != objects.params.timing:
-        doDrain(system)
         print "Changing memory mode to timing"
         for obj in system.descendants():
             obj.changeTiming(objects.params.timing)