gem5
v20.1.0.0
|
Miss Status and handling Register. More...
#include <mshr.hh>
Classes | |
class | Target |
class | TargetList |
Public Types | |
typedef std::list< MSHR * > | List |
A list of MSHRs. More... | |
typedef List::iterator | Iterator |
MSHR list iterator. More... | |
Public Member Functions | |
bool | needsWritable () const |
The pending* and post* flags are only valid if inService is true. More... | |
bool | isCleaning () const |
bool | isPendingModified () const |
bool | hasPostInvalidate () const |
bool | hasPostDowngrade () const |
bool | sendPacket (BaseCache &cache) override |
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entry type. More... | |
bool | allocOnFill () const |
bool | hasFromCache () const |
Determine if there are non-deferred requests from other caches. More... | |
bool | isWholeLineWrite () const |
Check if this MSHR contains only compatible writes, and if they span the entire cache line. More... | |
void | allocate (Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter _order, bool alloc_on_fill) |
Allocate a miss to this MSHR. More... | |
void | markInService (bool pending_modified_resp) |
void | clearDownstreamPending () |
void | deallocate () |
Mark this MSHR as free. More... | |
void | allocateTarget (PacketPtr target, Tick when, Counter order, bool alloc_on_fill) |
Add a request to the list of targets. More... | |
bool | handleSnoop (PacketPtr target, Counter order) |
MSHR () | |
A simple constructor. More... | |
int | getNumTargets () const |
Returns the current number of allocated targets. More... | |
TargetList | extractServiceableTargets (PacketPtr pkt) |
Extracts the subset of the targets that can be serviced given a received response. More... | |
bool | hasTargets () const |
Returns true if there are targets left. More... | |
QueueEntry::Target * | getTarget () override |
Returns a reference to the first target. More... | |
void | popTarget () |
Pop first target. More... | |
bool | promoteDeferredTargets () |
void | promoteReadable () |
Promotes deferred targets that do not require writable. More... | |
void | promoteWritable () |
Promotes deferred targets that do not require writable. More... | |
bool | trySatisfyFunctional (PacketPtr pkt) |
void | delay (Tick delay_ticks) |
Adds a delay relative to the current tick to the current MSHR. More... | |
void | print (std::ostream &os, int verbosity=0, const std::string &prefix="") const override |
Prints the contents of this MSHR for debugging. More... | |
std::string | print () const |
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overheads in fast mode. More... | |
bool | matchBlockAddr (const Addr addr, const bool is_secure) const override |
Check if entry corresponds to the one being looked for. More... | |
bool | matchBlockAddr (const PacketPtr pkt) const override |
Check if entry contains a packet that corresponds to the one being looked for. More... | |
bool | conflictAddr (const QueueEntry *entry) const override |
Check if given entry's packets conflict with this' entries packets. More... | |
Public Member Functions inherited from QueueEntry | |
QueueEntry () | |
bool | isUncacheable () const |
Public Member Functions inherited from Packet::SenderState | |
SenderState () | |
virtual | ~SenderState () |
Public Member Functions inherited from Printable | |
Printable () | |
virtual | ~Printable () |
Public Attributes | |
bool | wasWholeLineWrite |
Track if we sent this as a whole line write or not. More... | |
bool | isForward |
True if the entry is just a simple forward from an upper level. More... | |
Public Attributes inherited from QueueEntry | |
bool | inService |
True if the entry has been sent downstream. More... | |
Counter | order |
Order number assigned to disambiguate writes and misses. More... | |
Addr | blkAddr |
Block aligned address. More... | |
unsigned | blkSize |
Block size of the cache. More... | |
bool | isSecure |
True if the entry targets the secure memory space. More... | |
Public Attributes inherited from Packet::SenderState | |
SenderState * | predecessor |
Private Member Functions | |
void | promoteIf (const std::function< bool(Target &)> &pred) |
Promotes deferred targets that satisfy a predicate. More... | |
Private Attributes | |
bool | downstreamPending |
Flag set by downstream caches. More... | |
bool | pendingModified |
Here we use one flag to track both if: More... | |
bool | postInvalidate |
Did we snoop an invalidate while waiting for data? More... | |
bool | postDowngrade |
Did we snoop a read while waiting for data? More... | |
Iterator | readyIter |
Pointer to this MSHR on the ready list. More... | |
Iterator | allocIter |
Pointer to this MSHR on the allocated list. More... | |
TargetList | targets |
List of all requests that match the address. More... | |
TargetList | deferredTargets |
Friends | |
template<typename Entry > | |
class | Queue |
Consider the queues friends to avoid making everything public. More... | |
class | MSHRQueue |
Additional Inherited Members | |
Protected Attributes inherited from QueueEntry | |
Tick | readyTime |
Tick when ready to issue. More... | |
bool | _isUncacheable |
True if the entry is uncacheable. More... | |
Miss Status and handling Register.
This class keeps all the information needed to handle a cache miss including a list of target requests.
typedef List::iterator MSHR::Iterator |
typedef std::list<MSHR *> MSHR::List |
void MSHR::allocate | ( | Addr | blk_addr, |
unsigned | blk_size, | ||
PacketPtr | pkt, | ||
Tick | when_ready, | ||
Counter | _order, | ||
bool | alloc_on_fill | ||
) |
Allocate a miss to this MSHR.
blk_addr | The address of the block. |
blk_size | The number of bytes to request. |
pkt | The original miss. |
when_ready | When should the MSHR be ready to act upon. |
_order | The logical order of this MSHR |
alloc_on_fill | Should the cache allocate a block on fill |
Definition at line 294 of file mshr.cc.
References QueueEntry::_isUncacheable, MSHR::TargetList::add(), QueueEntry::blkAddr, QueueEntry::blkSize, Packet::cmd, deferredTargets, downstreamPending, MSHR::Target::FromCPU, MSHR::Target::FromPrefetcher, MemCmd::HardPFReq, MSHR::TargetList::init(), QueueEntry::inService, isForward, QueueEntry::isSecure, Packet::isSecure(), Packet::matchBlockAddr(), QueueEntry::order, QueueEntry::readyTime, Packet::req, targets, and wasWholeLineWrite.
Referenced by MSHRQueue::allocate().
Add a request to the list of targets.
target | The target. |
Definition at line 367 of file mshr.cc.
References MSHR::TargetList::add(), Packet::cmd, deferredTargets, MSHR::Target::FromCPU, MemCmd::HardPFReq, hasPostDowngrade(), hasPostInvalidate(), QueueEntry::inService, isForward, isPendingModified(), Packet::needsWritable(), replaceUpgrade(), Packet::req, and targets.
Referenced by BaseCache::handleTimingReqMiss().
|
inline |
Definition at line 332 of file mshr.hh.
References MSHR::TargetList::allocOnFill, and targets.
Referenced by print(), BaseCache::recvTimingResp(), and MSHR::TargetList::updateFlags().
void MSHR::clearDownstreamPending | ( | ) |
Definition at line 324 of file mshr.cc.
References MSHR::TargetList::clearDownstreamPending(), downstreamPending, and targets.
Referenced by MSHR::TargetList::clearDownstreamPending().
|
overridevirtual |
Check if given entry's packets conflict with this' entries packets.
entry | Other entry to compare against. |
Implements QueueEntry.
Definition at line 749 of file mshr.cc.
References QueueEntry::blkAddr, hasTargets(), QueueEntry::isSecure, and QueueEntry::matchBlockAddr().
void MSHR::deallocate | ( | ) |
Mark this MSHR as free.
Definition at line 355 of file mshr.cc.
References deferredTargets, QueueEntry::inService, MSHR::TargetList::isReset(), MSHR::TargetList::resetFlags(), and targets.
|
inline |
Adds a delay relative to the current tick to the current MSHR.
delay_ticks | the desired delay in ticks |
Definition at line 490 of file mshr.hh.
References curTick(), and QueueEntry::readyTime.
Referenced by MSHRQueue::delay().
MSHR::TargetList MSHR::extractServiceableTargets | ( | PacketPtr | pkt | ) |
Extracts the subset of the targets that can be serviced given a received response.
This function returns the targets list unless the response is a ReadRespWithInvalidate. The ReadRespWithInvalidate is only invalidating response that its invalidation was not expected when the request (a ReadSharedReq) was sent out. For ReadRespWithInvalidate we can safely service only the first FromCPU target and all FromSnoop targets (inform all snoopers that we no longer have the block).
pkt | The response from the downstream memory |
Definition at line 536 of file mshr.cc.
References QueueEntry::blkAddr, QueueEntry::blkSize, Packet::cmd, MSHR::Target::FromCPU, MSHR::Target::FromPrefetcher, MSHR::Target::FromSnoop, MSHR::TargetList::init(), MSHR::TargetList::populateFlags(), MemCmd::ReadRespWithInvalidate, and targets.
Referenced by NoncoherentCache::serviceMSHRTargets(), and Cache::serviceMSHRTargets().
|
inline |
Returns the current number of allocated targets.
Definition at line 422 of file mshr.hh.
References deferredTargets, and targets.
Referenced by MSHRQueue::allocate(), BaseCache::handleTimingReqMiss(), Cache::recvTimingSnoopReq(), and NoncoherentCache::serviceMSHRTargets().
|
inlineoverridevirtual |
Returns a reference to the first target.
Implements QueueEntry.
Definition at line 449 of file mshr.hh.
References hasTargets(), and targets.
Referenced by BaseCache::recvTimingResp(), Cache::sendMSHRQueuePacket(), BaseCache::sendMSHRQueuePacket(), NoncoherentCache::serviceMSHRTargets(), and Cache::serviceMSHRTargets().
Definition at line 412 of file mshr.cc.
References MSHR::TargetList::add(), QueueEntry::blkSize, Packet::cmd, curTick(), deferredTargets, downstreamPending, DPRINTF, MSHR::Target::FromSnoop, hasPostInvalidate(), Packet::id, QueueEntry::inService, Packet::isClean(), Packet::isExpressSnoop(), Packet::isInvalidate(), isPendingModified(), name(), Packet::needsResponse(), MSHR::TargetList::needsWritable, Packet::needsWritable(), panic_if, postDowngrade, postInvalidate, Packet::print(), MSHR::TargetList::replaceUpgrades(), Packet::req, Packet::setCacheResponding(), Packet::setHasSharers(), Packet::setResponderHadWritable(), Packet::setSatisfied(), and targets.
Referenced by Cache::recvTimingSnoopReq().
|
inline |
Determine if there are non-deferred requests from other caches.
Definition at line 341 of file mshr.hh.
References MSHR::TargetList::hasFromCache, and targets.
Referenced by print(), and MSHR::TargetList::updateFlags().
|
inline |
Definition at line 326 of file mshr.hh.
References QueueEntry::inService, and postDowngrade.
Referenced by allocateTarget(), promoteWritable(), and Cache::serviceMSHRTargets().
|
inline |
Definition at line 322 of file mshr.hh.
References QueueEntry::inService, and postInvalidate.
Referenced by allocateTarget(), handleSnoop(), promoteReadable(), promoteWritable(), and Cache::serviceMSHRTargets().
|
inline |
Returns true if there are targets left.
Definition at line 443 of file mshr.hh.
References targets.
Referenced by conflictAddr(), MSHRQueue::forceDeallocateTarget(), getTarget(), and matchBlockAddr().
|
inline |
Definition at line 313 of file mshr.hh.
References Packet::isClean(), and targets.
Referenced by BaseCache::handleEvictions().
|
inline |
Definition at line 318 of file mshr.hh.
References QueueEntry::inService, and pendingModified.
Referenced by allocateTarget(), BaseCache::functionalAccess(), and handleSnoop().
|
inline |
Check if this MSHR contains only compatible writes, and if they span the entire cache line.
This is used as part of the miss-packet creation. Note that new requests may arrive after a miss-packet has been created, and for the fill we therefore use the wasWholeLineWrite field.
Definition at line 382 of file mshr.hh.
References MSHR::TargetList::isWholeLineWrite(), and targets.
Referenced by markInService(), BaseCache::sendMSHRQueuePacket(), and MSHR::TargetList::updateWriteFlags().
void MSHR::markInService | ( | bool | pending_modified_resp | ) |
Definition at line 334 of file mshr.cc.
References MSHR::TargetList::clearDownstreamPending(), downstreamPending, QueueEntry::inService, isWholeLineWrite(), MSHR::TargetList::needsWritable, pendingModified, postDowngrade, postInvalidate, targets, and wasWholeLineWrite.
Referenced by MSHRQueue::markInService().
|
overridevirtual |
Check if entry corresponds to the one being looked for.
addr | Address to match against. |
is_secure | Whether the target should be in secure space or not. |
Implements QueueEntry.
Definition at line 735 of file mshr.cc.
References addr, QueueEntry::blkAddr, hasTargets(), and QueueEntry::isSecure.
|
overridevirtual |
Check if entry contains a packet that corresponds to the one being looked for.
pkt | The packet to search for. |
Implements QueueEntry.
Definition at line 742 of file mshr.cc.
References QueueEntry::blkAddr, QueueEntry::blkSize, hasTargets(), QueueEntry::isSecure, and Packet::matchBlockAddr().
|
inline |
The pending* and post* flags are only valid if inService is true.
Using the accessor functions lets us detect if these flags are accessed improperly. True if we need to get a writable copy of the block.
Definition at line 311 of file mshr.hh.
References MSHR::TargetList::needsWritable, and targets.
Referenced by BaseCache::handleEvictions(), print(), BaseCache::sendMSHRQueuePacket(), and MSHR::TargetList::updateFlags().
|
inline |
Pop first target.
Definition at line 458 of file mshr.hh.
References targets.
Referenced by MSHRQueue::forceDeallocateTarget().
std::string MSHR::print | ( | ) | const |
|
overridevirtual |
Prints the contents of this MSHR for debugging.
Implements Printable.
Definition at line 701 of file mshr.cc.
References QueueEntry::_isUncacheable, allocOnFill(), QueueEntry::blkAddr, QueueEntry::blkSize, ccprintf(), deferredTargets, downstreamPending, hasFromCache(), QueueEntry::inService, isForward, QueueEntry::isSecure, needsWritable(), X86ISA::os, postDowngrade, postInvalidate, MSHR::TargetList::print(), and targets.
Referenced by Cache::recvTimingSnoopReq().
bool MSHR::promoteDeferredTargets | ( | ) |
Definition at line 570 of file mshr.cc.
References curTick(), deferredTargets, QueueEntry::order, MSHR::TargetList::populateFlags(), QueueEntry::readyTime, ArmISA::t, and targets.
Referenced by MSHRQueue::forceDeallocateTarget(), and BaseCache::recvTimingResp().
|
private |
Promotes deferred targets that satisfy a predicate.
Deferred targets are promoted to the target list if they satisfy a given condition. The operation stops at the first deferred target that doesn't satisfy the condition.
pred | A condition on a Target |
Definition at line 609 of file mshr.cc.
References MSHR::TargetList::clearDownstreamPending(), deferredTargets, downstreamPending, MSHR::TargetList::populateFlags(), and targets.
Referenced by promoteReadable(), and promoteWritable().
void MSHR::promoteReadable | ( | ) |
Promotes deferred targets that do not require writable.
Move targets from the deferred targets list to the target list starting from the first deferred target until the first target that is a cache maintenance operation or needs a writable copy of the block
Definition at line 632 of file mshr.cc.
References deferredTargets, MSHR::Target::FromCPU, hasPostInvalidate(), promoteIf(), and ArmISA::t.
Referenced by BaseCache::recvTimingResp().
void MSHR::promoteWritable | ( | ) |
Promotes deferred targets that do not require writable.
Requests in the deferred target list are moved to the target list up until the first target that is a cache maintenance operation or needs a writable copy of the block
Definition at line 653 of file mshr.cc.
References deferredTargets, MSHR::Target::FromCPU, hasPostDowngrade(), hasPostInvalidate(), MSHR::TargetList::needsWritable, promoteIf(), Packet::req, ArmISA::t, and targets.
Referenced by BaseCache::recvTimingResp().
|
overridevirtual |
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entry type.
Implements QueueEntry.
Definition at line 695 of file mshr.cc.
References BaseCache::sendMSHRQueuePacket().
bool MSHR::trySatisfyFunctional | ( | PacketPtr | pkt | ) |
Definition at line 680 of file mshr.cc.
References QueueEntry::blkAddr, QueueEntry::blkSize, deferredTargets, Packet::isPrint(), QueueEntry::isSecure, targets, MSHR::TargetList::trySatisfyFunctional(), and Packet::trySatisfyFunctional().
|
friend |
|
private |
Pointer to this MSHR on the allocated list.
Definition at line 367 of file mshr.hh.
Referenced by MSHRQueue::allocate().
|
private |
Definition at line 372 of file mshr.hh.
Referenced by allocate(), allocateTarget(), deallocate(), getNumTargets(), handleSnoop(), print(), promoteDeferredTargets(), promoteIf(), promoteReadable(), promoteWritable(), and trySatisfyFunctional().
|
private |
Flag set by downstream caches.
Definition at line 82 of file mshr.hh.
Referenced by MSHR::TargetList::add(), allocate(), clearDownstreamPending(), handleSnoop(), markInService(), print(), and promoteIf().
bool MSHR::isForward |
True if the entry is just a simple forward from an upper level.
Definition at line 122 of file mshr.hh.
Referenced by allocate(), allocateTarget(), print(), BaseCache::recvTimingResp(), BaseCache::sendMSHRQueuePacket(), and Cache::serviceMSHRTargets().
|
private |
Here we use one flag to track both if:
Condition 2 is actually just a shortcut that saves us from possibly building a deferred target list and calling promoteWritable() every time we get a writable block. Condition 1, tracking ownership, is what is important. However, we never receive ownership without marking the block dirty, and consequently use pendingModified to track both ownership and writability rather than having separate pendingDirty and pendingWritable flags.
Definition at line 108 of file mshr.hh.
Referenced by isPendingModified(), and markInService().
|
private |
Did we snoop a read while waiting for data?
Definition at line 114 of file mshr.hh.
Referenced by handleSnoop(), hasPostDowngrade(), markInService(), and print().
|
private |
Did we snoop an invalidate while waiting for data?
Definition at line 111 of file mshr.hh.
Referenced by handleSnoop(), hasPostInvalidate(), markInService(), and print().
|
private |
Pointer to this MSHR on the ready list.
Definition at line 361 of file mshr.hh.
Referenced by MSHRQueue::allocate(), MSHRQueue::delay(), MSHRQueue::markInService(), MSHRQueue::markPending(), and MSHRQueue::moveToFront().
|
private |
List of all requests that match the address.
Definition at line 370 of file mshr.hh.
Referenced by allocate(), allocateTarget(), allocOnFill(), clearDownstreamPending(), deallocate(), extractServiceableTargets(), getNumTargets(), getTarget(), handleSnoop(), hasFromCache(), hasTargets(), isCleaning(), isWholeLineWrite(), markInService(), needsWritable(), popTarget(), print(), promoteDeferredTargets(), promoteIf(), promoteWritable(), and trySatisfyFunctional().
bool MSHR::wasWholeLineWrite |
Track if we sent this as a whole line write or not.
Definition at line 119 of file mshr.hh.
Referenced by allocate(), markInService(), BaseCache::recvTimingResp(), and Cache::serviceMSHRTargets().