arm, mem: Fix drain bug and provide drain prints for more components.
authorAli Saidi <Ali.Saidi@ARM.com>
Thu, 30 Oct 2014 04:18:26 +0000 (23:18 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Thu, 30 Oct 2014 04:18:26 +0000 (23:18 -0500)
src/arch/arm/table_walker.cc
src/mem/cache/mshr_queue.cc
src/mem/dram_ctrl.cc
src/mem/simple_mem.cc

index ed669919cd003b10ed192c170832fd1cff264171..adff57fdf7e37429f9bcb9d3752e2a9c6ce8c83b 100644 (file)
@@ -388,7 +388,6 @@ TableWalker::processWalkWrapper()
     // if we've still got pending translations schedule more work
     nextWalk(tc);
     currState = NULL;
-    completeDrain();
 }
 
 Fault
@@ -1677,7 +1676,6 @@ TableWalker::doL1DescriptorWrapper()
     doL1Descriptor();
 
     stateQueues[L1].pop_front();
-    completeDrain();
     // Check if fault was generated
     if (currState->fault != NoFault) {
         currState->transState->finish(currState->fault, currState->req,
@@ -1745,7 +1743,6 @@ TableWalker::doL2DescriptorWrapper()
 
 
     stateQueues[L2].pop_front();
-    completeDrain();
     pending = false;
     nextWalk(currState->tc);
 
@@ -1844,6 +1841,8 @@ TableWalker::nextWalk(ThreadContext *tc)
 {
     if (pendingQueue.size())
         schedule(doProcessEvent, clockEdge(Cycles(1)));
+    else
+        completeDrain();
 }
 
 bool
index 7bfbb90f5519266a936871583af688423227a91a..9146cddf73a654fb1eec8965aa0621592c59a365 100644 (file)
@@ -45,7 +45,9 @@
  * Definition of MSHRQueue class functions.
  */
 
+#include "base/trace.hh"
 #include "mem/cache/mshr_queue.hh"
+#include "debug/Drain.hh"
 
 using namespace std;
 
@@ -191,6 +193,7 @@ MSHRQueue::deallocateOne(MSHR *mshr)
     if (drainManager && allocated == 0) {
         // Notify the drain manager that we have completed draining if
         // there are no other outstanding requests in this MSHR queue.
+        DPRINTF(Drain, "MSHRQueue now empty, signalling drained\n");
         drainManager->signalDrainDone();
         drainManager = NULL;
         setDrainState(Drainable::Drained);
index f65f7e1ddb97ee64eda81f270115ec5027895620..1beebdd01c0741d56bdf7ad156014c29639f4c07 100644 (file)
@@ -737,6 +737,7 @@ DRAMCtrl::processRespondEvent()
         // if there is nothing left in any queue, signal a drain
         if (writeQueue.empty() && readQueue.empty() &&
             drainManager) {
+            DPRINTF(Drain, "DRAM controller done draining\n");
             drainManager->signalDrainDone();
             drainManager = NULL;
         }
@@ -1290,6 +1291,7 @@ DRAMCtrl::processNextReqEvent()
             } else {
                 // check if we are drained
                 if (respQueue.empty () && drainManager) {
+                    DPRINTF(Drain, "DRAM controller done draining\n");
                     drainManager->signalDrainDone();
                     drainManager = NULL;
                 }
index 27d3f11862d9e2199925ce303f41971a95a507c7..4e1020de59c71eb5c490225567d9c9d8472a4f45 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "base/random.hh"
 #include "mem/simple_mem.hh"
+#include "debug/Drain.hh"
 
 using namespace std;
 
@@ -200,6 +201,7 @@ SimpleMemory::dequeue()
             reschedule(dequeueEvent,
                        std::max(packetQueue.front().tick, curTick()), true);
         } else if (drainManager) {
+            DPRINTF(Drain, "Drainng of SimpleMemory complete\n");
             drainManager->signalDrainDone();
             drainManager = NULL;
         }
@@ -240,7 +242,8 @@ SimpleMemory::drain(DrainManager *dm)
     if (!packetQueue.empty()) {
         count += 1;
         drainManager = dm;
-    }
+        DPRINTF(Drain, "SimpleMemory Queue has requests, waiting to drain\n");
+     }
 
     if (count)
         setDrainState(Drainable::Draining);