summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:35 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:35 -0500
commit852a7bcf923af424de8df1ddbeb462d52de8383b (patch)
tree21fc1767419334465995ce8468d26cb3210056c8 /src/mem
parentce5fc494e3f26ef7e7c0c3b72eaa4a93a2d31b73 (diff)
downloadgem5-852a7bcf923af424de8df1ddbeb462d52de8383b.tar.xz
mem: Add sanity check to packet queue size
This patch adds a basic check to ensure that the packet queue does not grow absurdly large. The queue should only be used to store packets that were delayed due to blocking from the neighbouring port, and not for actual storage. Thus, a limit of 100 has been chosen for now (which is already quite substantial).
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/packet_queue.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mem/packet_queue.cc b/src/mem/packet_queue.cc
index 8030cb38f..e60e77453 100644
--- a/src/mem/packet_queue.cc
+++ b/src/mem/packet_queue.cc
@@ -113,6 +113,13 @@ PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool send_as_snoop)
// express snoops should never be queued
assert(!pkt->isExpressSnoop());
+ // add a very basic sanity check on the port to ensure the
+ // invisible buffer is not growing beyond reasonable limits
+ if (transmitList.size() > 100) {
+ panic("Packet queue %s has grown beyond 100 packets\n",
+ name());
+ }
+
// nothing on the list, or earlier than current front element,
// schedule an event
if (transmitList.empty() || when < transmitList.front().tick) {