mem: Determine if a packet queue forces ordering at construction

A packet queue is typically used to hold on to packets that are
schedules to be sent in the future or when they need to queue behind
younger packets that have been sent out yet. Due to memory order
requirements, some MemObjects need to maintain the order for packet
(mostly responses) that reference the same cache block.

Prior to this patch the ordering requirements where determined when
the packet was scheduled to be sent. This patch moves the parameter to
the constructor.

Change-Id: Ieb4d94e86bc7514f5036b313ec23ea47dd653164
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/15555
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Nikos Nikoleris
2018-11-27 16:55:50 +00:00
parent 1e9f65343c
commit ccc50b7355
9 changed files with 45 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012,2015 ARM Limited
* Copyright (c) 2012,2015,2018 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -49,9 +49,11 @@
PacketQueue::PacketQueue(EventManager& _em, const std::string& _label,
const std::string& _sendEventName,
bool force_order,
bool disable_sanity_check)
: em(_em), sendEvent([this]{ processSendEvent(); }, _sendEventName),
_disableSanityCheck(disable_sanity_check),
forceOrder(force_order),
label(_label), waitingOnRetry(false)
{
}
@@ -102,11 +104,11 @@ PacketQueue::trySatisfyFunctional(PacketPtr pkt)
}
void
PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool force_order)
PacketQueue::schedSendTiming(PacketPtr pkt, Tick when)
{
DPRINTF(PacketQueue, "%s for %s address %x size %d when %lu ord: %i\n",
__func__, pkt->cmdString(), pkt->getAddr(), pkt->getSize(), when,
force_order);
forceOrder);
// we can still send a packet before the end of this tick
assert(when >= curTick());
@@ -137,13 +139,13 @@ PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool force_order)
// assert(waitingOnRetry || sendEvent.scheduled());
// this belongs in the middle somewhere, so search from the end to
// order by tick; however, if force_order is set, also make sure
// order by tick; however, if forceOrder is set, also make sure
// not to re-order in front of some existing packet with the same
// address
auto i = transmitList.end();
--i;
while (i != transmitList.begin() && when < i->tick &&
!(force_order && i->pkt->getAddr() == pkt->getAddr()))
!(forceOrder && i->pkt->getAddr() == pkt->getAddr()))
--i;
// emplace inserts the element before the position pointed to by
@@ -250,8 +252,9 @@ ReqPacketQueue::sendTiming(PacketPtr pkt)
SnoopRespPacketQueue::SnoopRespPacketQueue(EventManager& _em,
MasterPort& _masterPort,
bool force_order,
const std::string _label)
: PacketQueue(_em, _label, name(_masterPort, _label)),
: PacketQueue(_em, _label, name(_masterPort, _label), force_order),
masterPort(_masterPort)
{
}
@@ -263,8 +266,9 @@ SnoopRespPacketQueue::sendTiming(PacketPtr pkt)
}
RespPacketQueue::RespPacketQueue(EventManager& _em, SlavePort& _slavePort,
bool force_order,
const std::string _label)
: PacketQueue(_em, _label, name(_slavePort, _label)),
: PacketQueue(_em, _label, name(_slavePort, _label), force_order),
slavePort(_slavePort)
{
}