Fix subtle cache bug where read could return stale data
authorSteve Reinhardt <stever@gmail.com>
Sat, 15 Mar 2008 12:03:55 +0000 (05:03 -0700)
committerSteve Reinhardt <stever@gmail.com>
Sat, 15 Mar 2008 12:03:55 +0000 (05:03 -0700)
if a prior write miss arrived while an even earlier
read miss was still outstanding.

--HG--
extra : convert_revision : 4924e145829b2ecf4610b88d33f4773510c6801a

src/mem/cache/cache_impl.hh

index e546e2a9ae13ac6d81fc6568013efcd49397267e..5aecea7d58eab4b520e257a93b574c85b753c78f 100644 (file)
@@ -825,6 +825,10 @@ Cache<TagStore>::handleResponse(PacketPtr pkt)
     }
 
     if (mshr->promoteDeferredTargets()) {
+        assert(mshr->needsExclusive() && !blk->isWritable());
+        // avoid later read getting stale data while write miss is
+        // outstanding.. see comment in timingAccess()
+        blk->status &= ~BlkReadable;
         MSHRQueue *mq = mshr->queue;
         mq->markPending(mshr);
         requestMemSideBus((RequestCause)mq->index, pkt->finishTime);