mem: Add checks and explanation for assertMemInhibit usage
authorAndreas Hansson <andreas.hansson@arm.com>
Tue, 2 Dec 2014 11:07:46 +0000 (06:07 -0500)
committerAndreas Hansson <andreas.hansson@arm.com>
Tue, 2 Dec 2014 11:07:46 +0000 (06:07 -0500)
src/mem/cache/cache_impl.hh
src/mem/packet.hh

index 2eb38805c2f454d95c49ea10ff4644d0888b72a7..535dc81c20dab46a753cf017fe3f77cbecfd31bb 100644 (file)
@@ -1693,7 +1693,12 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk,
     }
 
     if (respond) {
-        assert(!pkt->memInhibitAsserted());
+        // prevent anyone else from responding, cache as well as
+        // memory, and also prevent any memory from even seeing the
+        // request (with current inhibited semantics), note that this
+        // applies both to reads and writes and that for writes it
+        // works thanks to the fact that we still have dirty data and
+        // will write it back at a later point
         pkt->assertMemInhibit();
         if (have_exclusive) {
             pkt->setSupplyExclusive();
index 19423db589fde00f75f268948b1483fd6db88574..b212de7c8747986ddab696696cea7e691b3b26b7 100644 (file)
@@ -504,7 +504,12 @@ class Packet : public Printable
     bool isFlush() const        { return cmd.isFlush(); }
 
     // Snoop flags
-    void assertMemInhibit()         { flags.set(MEM_INHIBIT); }
+    void assertMemInhibit()
+    {
+        assert(isRequest());
+        assert(!flags.isSet(MEM_INHIBIT));
+        flags.set(MEM_INHIBIT);
+    }
     bool memInhibitAsserted() const { return flags.isSet(MEM_INHIBIT); }
     void assertShared()             { flags.set(SHARED); }
     bool sharedAsserted() const     { return flags.isSet(SHARED); }