cpu,o3: Fixed checkpointing bug occuring in the o3 CPU
authorAnouk Van Laer <anouk.vanlaer@arm.com>
Thu, 6 Apr 2017 14:38:07 +0000 (15:38 +0100)
committerAnouk Van Laer <anouk.vanlaer@arm.com>
Mon, 17 Jul 2017 17:50:52 +0000 (17:50 +0000)
Checkpointing a system with out-of-order CPUs might get stuck if
one of the CPUs has been put to sleep. The quiesce instruction
cannot get drained hence checkpointing never finishes.

This commit resolves that by activating all suspended thread
contexts when draining the system.

Change-Id: I817ab1672b4ead777bd8e12a0445829481c46fdc
Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/3970
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/cpu/o3/cpu.cc

index 09790f4cef225e35d064876b2a96402f733a6dc1..0695711f174ae3e99a047faa48308610d11f75f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012, 2014, 2016 ARM Limited
+ * Copyright (c) 2011-2012, 2014, 2016, 2017 ARM Limited
  * Copyright (c) 2013 Advanced Micro Devices, Inc.
  * All rights reserved
  *
@@ -1048,6 +1048,17 @@ FullO3CPU<Impl>::drain()
     // Wake the CPU and record activity so everything can drain out if
     // the CPU was not able to immediately drain.
     if (!isDrained())  {
+        // If a thread is suspended, wake it up so it can be drained
+        for (auto t : threadContexts) {
+            if (t->status() == ThreadContext::Suspended){
+                DPRINTF(Drain, "Currently suspended so activate %i \n",
+                        t->threadId());
+                t->activate();
+                // As the thread is now active, change the power state as well
+                activateContext(t->threadId());
+            }
+        }
+
         wakeCPU();
         activityRec.activity();