summaryrefslogtreecommitdiff
path: root/src/mem/packet.hh
diff options
context:
space:
mode:
authorAli Jafri <ali.jafri@arm.com>2015-06-09 09:21:18 -0400
committerAli Jafri <ali.jafri@arm.com>2015-06-09 09:21:18 -0400
commitf0c3b704516362f11b0ec53a2f7dae8854349ac4 (patch)
tree93346e27d698b53ce7bc956906d3e30b6e0051fc /src/mem/packet.hh
parent578a7f20c647e4051e137bdb219cec450a741ca6 (diff)
downloadgem5-f0c3b704516362f11b0ec53a2f7dae8854349ac4.tar.xz
mem: Add check for express snoop in packet destructor
Snoop packets share the request pointer with the originating packets. We need to ensure that the snoop packet destruction does not delete the request. Snoops are used for reads, invalidations, HardPFReqs, Writebacks and CleansEvicts. Reads, invalidations, and HardPFReqs need a response so their snoops do not delete the request. For Writebacks and CleanEvicts we need to check explicitly for whethere the current packet is an express snoop, in whcih case do not delete the request.
Diffstat (limited to 'src/mem/packet.hh')
-rw-r--r--src/mem/packet.hh15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 10a4f7e89..3f10458e7 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -692,11 +692,18 @@ class Packet : public Printable
*/
~Packet()
{
- // If this is a request packet for which there's no response,
- // delete the request object here, since the requester will
- // never get the chance.
- if (req && isRequest() && !needsResponse())
+ // Delete the request object if this is a request packet which
+ // does not need a response, because the requester will not get
+ // a chance. If the request packet needs a response then the
+ // request will be deleted on receipt of the response
+ // packet. We also make sure to never delete the request for
+ // express snoops, even for cases when responses are not
+ // needed (CleanEvict and Writeback), since the snoop packet
+ // re-uses the same request.
+ if (req && isRequest() && !needsResponse() &&
+ !isExpressSnoop()) {
delete req;
+ }
deleteData();
}