summaryrefslogtreecommitdiff
path: root/src/mem/cache/cache_impl.hh
diff options
context:
space:
mode:
authorStephan Diestelhorst <stephan.diestelhorst@ARM.com>2015-03-17 11:50:55 +0000
committerStephan Diestelhorst <stephan.diestelhorst@ARM.com>2015-03-17 11:50:55 +0000
commit2847d5f5177304236dcdbab112a0369f0bd96aea (patch)
treeec99cb6bb885cd97a6eb81cb07bc1710b3e348fb /src/mem/cache/cache_impl.hh
parent706597f021811511e71fddeeab7dcfc33bfd5f35 (diff)
downloadgem5-2847d5f5177304236dcdbab112a0369f0bd96aea.tar.xz
mem: Create a request copy for deferred snoops
Sometimes, we need to defer an express snoop in an MSHR, but the original request might complete and deallocate the original pkt->req. In those cases, create a copy of the request so that someone who is inspecting the delayed snoop can also inspect the request still. All of this is rather hacky, but the allocation / linking and general life-time management of Packet and Request is rather tricky. Deleting the copy is another tricky area, testing so far has shown that the right copy is deleted at the right time.
Diffstat (limited to 'src/mem/cache/cache_impl.hh')
-rw-r--r--src/mem/cache/cache_impl.hh12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh
index d36195fe9..734ca826c 100644
--- a/src/mem/cache/cache_impl.hh
+++ b/src/mem/cache/cache_impl.hh
@@ -1713,8 +1713,16 @@ Cache::handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing,
if (!respond && is_timing && is_deferred) {
// if it's a deferred timing snoop then we've made a copy of
- // the packet, and so if we're not using that copy to respond
- // then we need to delete it here.
+ // both the request and the packet, and so if we're not using
+ // those copies to respond and delete them here
+ DPRINTF(Cache, "Deleting pkt %p and request %p for cmd %s addr: %p\n",
+ pkt, pkt->req, pkt->cmdString(), pkt->getAddr());
+
+ // the packets needs a response (just not from us), so we also
+ // need to delete the request and not rely on the packet
+ // destructor
+ assert(pkt->needsResponse());
+ delete pkt->req;
delete pkt;
}