Fix a bug to handle the fact that a CPU can send Functional accesses while a sendTimi...
[gem5.git] / src / mem / cache / base_cache.cc
index c16cb6945993f9d07cd8bb0867ba8a2ecf07e368..3af61375d45e1a166f9b052e4e7ce915d27730b3 100644 (file)
@@ -160,11 +160,14 @@ BaseCache::CachePort::recvRetry()
     PacketPtr pkt;
     assert(waitingOnRetry);
     if (!drainList.empty()) {
-        DPRINTF(CachePort, "%s attempting to send a retry for response\n", name());
+        DPRINTF(CachePort, "%s attempting to send a retry for response (%i waiting)\n"
+                , name(), drainList.size());
         //We have some responses to drain first
-        if (sendTiming(drainList.front())) {
-            DPRINTF(CachePort, "%s sucessful in sending a retry for response\n", name());
-            drainList.pop_front();
+        pkt = drainList.front();
+        drainList.pop_front();
+        if (sendTiming(pkt)) {
+            DPRINTF(CachePort, "%s sucessful in sending a retry for"
+                    "response (%i still waiting)\n", name(), drainList.size());
             if (!drainList.empty() ||
                 !isCpuSide && cache->doMasterRequest() ||
                 isCpuSide && cache->doSlaveRequest()) {
@@ -175,6 +178,9 @@ BaseCache::CachePort::recvRetry()
             }
             waitingOnRetry = false;
         }
+        else {
+            drainList.push_front(pkt);
+        }
         // Check if we're done draining once this list is empty
         if (drainList.empty())
             cache->checkDrain();