diff options
author | Joel Hestness <jthestness@gmail.com> | 2016-12-20 11:38:24 -0600 |
---|---|---|
committer | Joel Hestness <jthestness@gmail.com> | 2016-12-20 11:38:24 -0600 |
commit | 3a656da1a64f08d5e4c755e94cefda5a4e985a50 (patch) | |
tree | 945725f5b79c1124bb032c44f191e628ba4328c1 /src/mem/ruby/network/MessageBuffer.hh | |
parent | 3eb979a8cedde55f4fe3c6cab4b5e591e664dd96 (diff) | |
download | gem5-3a656da1a64f08d5e4c755e94cefda5a4e985a50.tar.xz |
ruby: Make MessageBuffers actually finite sized
When Ruby controllers stall messages in MessageBuffers, the buffer moves those
messages off the priority heap and into a per-address stall map. When buffers
are finite-sized, the test areNSlotsAvailable() only checks the size of the
priority heap, but ignores the stall map, so the map is allowed to grow
unbounded if the controller stalls numerous messages. This patch fixes the
problem by tracking the stall map size and testing the total number of messages
in the buffer appropriately.
Diffstat (limited to 'src/mem/ruby/network/MessageBuffer.hh')
-rw-r--r-- | src/mem/ruby/network/MessageBuffer.hh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh index 2a82887cd..b1d04ab9a 100644 --- a/src/mem/ruby/network/MessageBuffer.hh +++ b/src/mem/ruby/network/MessageBuffer.hh @@ -137,9 +137,37 @@ class MessageBuffer : public SimObject // sorted and ensures a well-defined iteration order typedef std::map<Addr, std::list<MsgPtr> > StallMsgMapType; + /** + * A map from line addresses to lists of stalled messages for that line. + * If this buffer allows the receiver to stall messages, on a stall + * request, the stalled message is removed from the m_prio_heap and placed + * in the m_stall_msg_map. Messages are held there until the receiver + * requests they be reanalyzed, at which point they are moved back to + * m_prio_heap. + * + * NOTE: The stall map holds messages in the order in which they were + * initially received, and when a line is unblocked, the messages are + * moved back to the m_prio_heap in the same order. This prevents starving + * older requests with younger ones. + */ StallMsgMapType m_stall_msg_map; + /** + * Current size of the stall map. + * Track the number of messages held in stall map lists. This is used to + * ensure that if the buffer is finite-sized, it blocks further requests + * when the m_prio_heap and m_stall_msg_map contain m_max_size messages. + */ + int m_stall_map_size; + + /** + * The maximum capacity. For finite-sized buffers, m_max_size stores a + * number greater than 0 to indicate the maximum allowed number of messages + * in the buffer at any time. To get infinitely-sized buffers, set buffer + * size: m_max_size = 0 + */ const unsigned int m_max_size; + Tick m_time_last_time_size_checked; unsigned int m_size_last_time_size_checked; |