From 3d6ec81e6612547efa22507f6e82d5d9c7d75252 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 2 Dec 2014 06:07:46 -0500 Subject: [PATCH] mem: Add checks and explanation for assertMemInhibit usage --- src/mem/cache/cache_impl.hh | 7 ++++++- src/mem/packet.hh | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 2eb38805c..535dc81c2 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1693,7 +1693,12 @@ Cache::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(); diff --git a/src/mem/packet.hh b/src/mem/packet.hh index 19423db58..b212de7c8 100644 --- a/src/mem/packet.hh +++ b/src/mem/packet.hh @@ -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); } -- 2.30.2