Couple minor bug fixes...
authorSteve Reinhardt <stever@eecs.umich.edu>
Tue, 26 Jun 2007 05:23:29 +0000 (22:23 -0700)
committerSteve Reinhardt <stever@eecs.umich.edu>
Tue, 26 Jun 2007 05:23:29 +0000 (22:23 -0700)
src/mem/cache/cache_impl.hh:
    Handle grants with no packet.
src/mem/cache/miss/mshr.cc:
    Fix MSHR snoop hit handling.

--HG--
extra : convert_revision : f365283afddaa07cb9e050b2981ad6a898c14451

src/mem/cache/cache_impl.hh
src/mem/cache/miss/mshr.cc

index 7610b5a41d136e63071386155ef255cff3cdee91..48efc5ca3f976fbabe01ca958c466c48cfa59014 100644 (file)
@@ -912,7 +912,6 @@ Cache<TagStore,Coherence>::snoopTiming(PacketPtr pkt)
 
             if (pkt->isInvalidate()) {
                 // Invalidation trumps our writeback... discard here
-                assert(0);
                 markInService(mshr);
             }
             return;
@@ -1201,18 +1200,24 @@ Cache<TagStore,Coherence>::MemSidePort::sendPacket()
     } else {
         // check for non-response packets (requests & writebacks)
         PacketPtr pkt = myCache()->getTimingPacket();
-        assert(pkt != NULL);
-        MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState);
+        if (pkt == NULL) {
+            // can happen if e.g. we attempt a writeback and fail, but
+            // before the retry, the writeback is eliminated because
+            // we snoop another cache's ReadEx.
+            waitingOnRetry = false;
+        } else {
+            MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState);
 
-        bool success = sendTiming(pkt);
-        DPRINTF(Cache, "Address %x was %s in sending the timing request\n",
-                pkt->getAddr(), success ? "successful" : "unsuccessful");
+            bool success = sendTiming(pkt);
+            DPRINTF(Cache, "Address %x was %s in sending the timing request\n",
+                    pkt->getAddr(), success ? "successful" : "unsuccessful");
 
-        waitingOnRetry = !success;
-        if (waitingOnRetry) {
-            DPRINTF(CachePort, "now waiting on a retry\n");
-        } else {
-            myCache()->markInService(mshr);
+            waitingOnRetry = !success;
+            if (waitingOnRetry) {
+                DPRINTF(CachePort, "now waiting on a retry\n");
+            } else {
+                myCache()->markInService(mshr);
+            }
         }
     }
 
index 8fa11ab2e69736b3752d1560abb813fd8928ffc9..fc8d2175ef11d82603f04d39ff3cd8c13b4f4010 100644 (file)
@@ -132,13 +132,15 @@ MSHR::allocateSnoopTarget(PacketPtr target, Tick when, Counter _order)
         // We're awaiting an exclusive copy, so ownership is pending.
         // It's up to us to respond once the data arrives.
         target->assertMemInhibit();
-    } else if (target->needsExclusive()) {
+    }
+
+    if (target->needsExclusive()) {
         // This transaction will take away our pending copy
         pendingInvalidate = true;
     } else {
-        // If we're not going to supply data or perform an
-        // invalidation, we don't need to save this.
-        return;
+        // We'll keep our pending copy, but we can't let the other guy
+        // think he's getting it exclusive
+        target->assertShared();
     }
 
     targets.push_back(Target(target, when, _order, false));