Fix bug on exclusive response to ReadReq with pending WriteReq.
authorSteve Reinhardt <stever@gmail.com>
Sat, 17 Nov 2007 04:10:32 +0000 (20:10 -0800)
committerSteve Reinhardt <stever@gmail.com>
Sat, 17 Nov 2007 04:10:32 +0000 (20:10 -0800)
--HG--
extra : convert_revision : 5429cd7ca84cf6348813a4607fa16f76aa5df7e0

src/mem/cache/miss/mshr.cc

index 4e9b984818bf5d78665bcf85a82bb39974032566..e2ff444d570c0b6098b1e5bff689bfdc42f6a3cf 100644 (file)
@@ -330,6 +330,23 @@ MSHR::handleFill(Packet *pkt, CacheBlk *blk)
         // service... assert shared line on its behalf
         pkt->assertShared();
     }
+
+    if (!pkt->sharedAsserted() && !pendingInvalidate
+        && deferredTargets->needsExclusive) {
+        // We got an exclusive response, but we have deferred targets
+        // which are waiting to request an exclusive copy (not because
+        // of a pending invalidate).  This can happen if the original
+        // request was for a read-only (non-exclusive) block, but we
+        // got an exclusive copy anyway because of the E part of the
+        // MOESI/MESI protocol.  Since we got the exclusive copy
+        // there's no need to defer the targets, so move them up to
+        // the regular target list.
+        assert(!targets->needsExclusive);
+        targets->needsExclusive = true;
+        // this clears out deferredTargets too
+        targets->splice(targets->end(), *deferredTargets);
+        deferredTargets->resetFlags();
+    }
 }