gem5 v24.0.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. | |
typedef List::iterator | Iterator |
MSHR list iterator. | |
Public Member Functions | |
bool | needsWritable () const |
The pending* and post* flags are only valid if inService is true. | |
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. | |
bool | allocOnFill () const |
bool | hasFromCache () const |
Determine if there are non-deferred requests from other caches. | |
void | updateLockedRMWReadTarget (PacketPtr pkt) |
Replaces the matching packet in the Targets list with a dummy packet to ensure the MSHR remains allocated until the corresponding locked write arrives. | |
bool | hasLockedRMWReadTarget () |
Determine if there are any LockedRMWReads in the Targets list. | |
bool | isWholeLineWrite () const |
Check if this MSHR contains only compatible writes, and if they span the entire cache line. | |
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. | |
void | markInService (bool pending_modified_resp) |
void | clearDownstreamPending () |
void | deallocate () |
Mark this MSHR as free. | |
void | allocateTarget (PacketPtr target, Tick when, Counter order, bool alloc_on_fill) |
Add a request to the list of targets. | |
bool | handleSnoop (PacketPtr target, Counter order) |
MSHR (const std::string &name) | |
A simple constructor. | |
int | getNumTargets () const |
Returns the current number of allocated targets. | |
TargetList | extractServiceableTargets (PacketPtr pkt) |
Extracts the subset of the targets that can be serviced given a received response. | |
bool | hasTargets () const |
Returns true if there are targets left. | |
QueueEntry::Target * | getTarget () override |
Returns a reference to the first target. | |
void | popTarget () |
Pop first target. | |
bool | promoteDeferredTargets () |
void | promoteReadable () |
Promotes deferred targets that do not require writable. | |
void | promoteWritable () |
Promotes deferred targets that do not require writable. | |
bool | trySatisfyFunctional (PacketPtr pkt) |
void | delay (Tick delay_ticks) |
Adds a delay relative to the current tick to the current MSHR. | |
void | print (std::ostream &os, int verbosity=0, const std::string &prefix="") const override |
Prints the contents of this MSHR for debugging. | |
std::string | print () const |
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overheads in fast mode. | |
bool | matchBlockAddr (const Addr addr, const bool is_secure) const override |
Check if entry corresponds to the one being looked for. | |
bool | matchBlockAddr (const PacketPtr pkt) const override |
Check if entry contains a packet that corresponds to the one being looked for. | |
bool | conflictAddr (const QueueEntry *entry) const override |
Check if given entry's packets conflict with this' entries packets. | |
Public Member Functions inherited from gem5::QueueEntry | |
QueueEntry (const std::string &name) | |
bool | isUncacheable () const |
Public Member Functions inherited from gem5::Packet::SenderState | |
SenderState () | |
virtual | ~SenderState () |
Public Member Functions inherited from gem5::Named | |
Named (const std::string &name_) | |
virtual | ~Named ()=default |
virtual std::string | name () const |
Public Member Functions inherited from gem5::Printable | |
Printable () | |
virtual | ~Printable () |
Public Attributes | |
bool | wasWholeLineWrite |
Track if we sent this as a whole line write or not. | |
bool | isForward |
True if the entry is just a simple forward from an upper level. | |
Public Attributes inherited from gem5::QueueEntry | |
bool | inService |
True if the entry has been sent downstream. | |
Counter | order |
Order number assigned to disambiguate writes and misses. | |
Addr | blkAddr |
Block aligned address. | |
unsigned | blkSize |
Block size of the cache. | |
bool | isSecure |
True if the entry targets the secure memory space. | |
Public Attributes inherited from gem5::Packet::SenderState | |
SenderState * | predecessor |
Private Member Functions | |
void | promoteIf (const std::function< bool(Target &)> &pred) |
Promotes deferred targets that satisfy a predicate. | |
Private Attributes | |
bool | downstreamPending |
Flag set by downstream caches. | |
bool | pendingModified |
Here we use one flag to track both if: | |
bool | postInvalidate |
Did we snoop an invalidate while waiting for data? | |
bool | postDowngrade |
Did we snoop a read while waiting for data? | |
Iterator | readyIter |
Pointer to this MSHR on the ready list. | |
Iterator | allocIter |
Pointer to this MSHR on the allocated list. | |
TargetList | targets |
List of all requests that match the address. | |
TargetList | deferredTargets |
Friends | |
template<typename Entry > | |
class | Queue |
Consider the queues friends to avoid making everything public. | |
class | MSHRQueue |
Additional Inherited Members | |
Protected Attributes inherited from gem5::QueueEntry | |
Tick | readyTime |
Tick when ready to issue. | |
bool | _isUncacheable |
True if the entry is uncacheable. | |
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 gem5::MSHR::Iterator |
typedef std::list<MSHR *> gem5::MSHR::List |
gem5::MSHR::MSHR | ( | const std::string & | name | ) |
void gem5::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 304 of file mshr.cc.
References gem5::QueueEntry::_isUncacheable, gem5::MSHR::TargetList::add(), gem5::QueueEntry::blkAddr, gem5::QueueEntry::blkSize, gem5::Packet::cmd, deferredTargets, downstreamPending, gem5::MSHR::Target::FromCPU, gem5::MSHR::Target::FromPrefetcher, gem5::MemCmd::HardPFReq, gem5::MSHR::TargetList::init(), gem5::QueueEntry::inService, isForward, gem5::Packet::isSecure(), gem5::QueueEntry::isSecure, gem5::Packet::matchBlockAddr(), gem5::QueueEntry::order, gem5::QueueEntry::readyTime, gem5::Packet::req, targets, and wasWholeLineWrite.
Referenced by gem5::MSHRQueue::allocate().
Add a request to the list of targets.
target | The target. |
Definition at line 377 of file mshr.cc.
References gem5::MSHR::TargetList::add(), gem5::Packet::cmd, deferredTargets, DPRINTF, gem5::MSHR::Target::FromCPU, gem5::MemCmd::HardPFReq, hasPostDowngrade(), hasPostInvalidate(), gem5::QueueEntry::inService, isForward, isPendingModified(), gem5::Packet::needsWritable(), print(), gem5::replaceUpgrade(), gem5::Packet::req, and targets.
Referenced by gem5::BaseCache::handleTimingReqMiss().
|
inline |
Definition at line 340 of file mshr.hh.
References gem5::MSHR::TargetList::allocOnFill, and targets.
Referenced by print(), gem5::BaseCache::recvTimingResp(), and gem5::MSHR::TargetList::updateFlags().
void gem5::MSHR::clearDownstreamPending | ( | ) |
Definition at line 334 of file mshr.cc.
References gem5::MSHR::TargetList::clearDownstreamPending(), downstreamPending, and targets.
Referenced by gem5::MSHR::TargetList::clearDownstreamPending().
|
overridevirtual |
Check if given entry's packets conflict with this' entries packets.
entry | Other entry to compare against. |
Implements gem5::QueueEntry.
Definition at line 779 of file mshr.cc.
References gem5::QueueEntry::blkAddr, hasTargets(), gem5::QueueEntry::isSecure, and gem5::QueueEntry::matchBlockAddr().
void gem5::MSHR::deallocate | ( | ) |
Mark this MSHR as free.
Definition at line 365 of file mshr.cc.
References deferredTargets, gem5::QueueEntry::inService, gem5::MSHR::TargetList::isReset(), gem5::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 516 of file mshr.hh.
References gem5::curTick(), and gem5::QueueEntry::readyTime.
Referenced by gem5::MSHRQueue::delay().
MSHR::TargetList gem5::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 548 of file mshr.cc.
References gem5::QueueEntry::blkAddr, gem5::QueueEntry::blkSize, gem5::Packet::cmd, gem5::MSHR::Target::FromCPU, gem5::MSHR::Target::FromPrefetcher, gem5::MSHR::Target::FromSnoop, gem5::MSHR::TargetList::init(), gem5::MemCmd::LockedRMWReadReq, gem5::MSHR::TargetList::populateFlags(), gem5::MemCmd::ReadRespWithInvalidate, and targets.
Referenced by gem5::Cache::serviceMSHRTargets(), and gem5::NoncoherentCache::serviceMSHRTargets().
|
inline |
Returns the current number of allocated targets.
Definition at line 446 of file mshr.hh.
References deferredTargets, and targets.
Referenced by gem5::MSHRQueue::allocate(), gem5::BaseCache::handleTimingReqMiss(), gem5::Cache::recvTimingSnoopReq(), and gem5::NoncoherentCache::serviceMSHRTargets().
|
inlineoverridevirtual |
Returns a reference to the first target.
Implements gem5::QueueEntry.
Definition at line 473 of file mshr.hh.
References hasTargets(), and targets.
Referenced by gem5::BaseCache::recvTimingResp(), gem5::BaseCache::sendMSHRQueuePacket(), gem5::Cache::sendMSHRQueuePacket(), gem5::Cache::serviceMSHRTargets(), and gem5::NoncoherentCache::serviceMSHRTargets().
Definition at line 424 of file mshr.cc.
References gem5::MSHR::TargetList::add(), gem5::QueueEntry::blkSize, gem5::Packet::cmd, gem5::curTick(), deferredTargets, downstreamPending, DPRINTF, gem5::MSHR::Target::FromSnoop, hasPostInvalidate(), gem5::Packet::id, gem5::QueueEntry::inService, gem5::Packet::isClean(), gem5::Packet::isExpressSnoop(), gem5::Packet::isInvalidate(), isPendingModified(), gem5::Named::name(), gem5::Packet::needsResponse(), gem5::MSHR::TargetList::needsWritable, gem5::Packet::needsWritable(), panic_if, postDowngrade, postInvalidate, gem5::Packet::print(), gem5::MSHR::TargetList::replaceUpgrades(), gem5::Packet::req, gem5::Packet::setCacheResponding(), gem5::Packet::setHasSharers(), gem5::Packet::setResponderHadWritable(), gem5::Packet::setSatisfied(), and targets.
Referenced by gem5::Cache::recvTimingSnoopReq().
|
inline |
Determine if there are non-deferred requests from other caches.
Definition at line 349 of file mshr.hh.
References gem5::MSHR::TargetList::hasFromCache, and targets.
Referenced by print(), and gem5::MSHR::TargetList::updateFlags().
bool gem5::MSHR::hasLockedRMWReadTarget | ( | ) |
Determine if there are any LockedRMWReads in the Targets list.
Definition at line 794 of file mshr.cc.
References gem5::MemCmd::LockedRMWReadReq, and targets.
Referenced by gem5::BaseCache::recvTimingResp(), and gem5::Cache::serviceMSHRTargets().
|
inline |
Definition at line 334 of file mshr.hh.
References gem5::QueueEntry::inService, and postDowngrade.
Referenced by allocateTarget(), promoteWritable(), and gem5::Cache::serviceMSHRTargets().
|
inline |
Definition at line 330 of file mshr.hh.
References gem5::QueueEntry::inService, and postInvalidate.
Referenced by allocateTarget(), handleSnoop(), promoteReadable(), promoteWritable(), and gem5::Cache::serviceMSHRTargets().
|
inline |
Returns true if there are targets left.
Definition at line 467 of file mshr.hh.
References targets.
Referenced by conflictAddr(), gem5::MSHRQueue::forceDeallocateTarget(), getTarget(), matchBlockAddr(), and matchBlockAddr().
|
inline |
Definition at line 321 of file mshr.hh.
References gem5::Packet::isClean(), and targets.
Referenced by gem5::BaseCache::handleEvictions().
|
inline |
Definition at line 326 of file mshr.hh.
References gem5::QueueEntry::inService, and pendingModified.
Referenced by allocateTarget(), gem5::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 406 of file mshr.hh.
References gem5::MSHR::TargetList::isWholeLineWrite(), and targets.
Referenced by markInService(), gem5::BaseCache::sendMSHRQueuePacket(), and gem5::MSHR::TargetList::updateWriteFlags().
void gem5::MSHR::markInService | ( | bool | pending_modified_resp | ) |
Definition at line 344 of file mshr.cc.
References gem5::MSHR::TargetList::clearDownstreamPending(), downstreamPending, gem5::QueueEntry::inService, isWholeLineWrite(), gem5::MSHR::TargetList::needsWritable, pendingModified, postDowngrade, postInvalidate, targets, and wasWholeLineWrite.
Referenced by gem5::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 gem5::QueueEntry.
Definition at line 765 of file mshr.cc.
References gem5::X86ISA::addr, gem5::QueueEntry::blkAddr, hasTargets(), and gem5::QueueEntry::isSecure.
|
overridevirtual |
Check if entry contains a packet that corresponds to the one being looked for.
pkt | The packet to search for. |
Implements gem5::QueueEntry.
Definition at line 772 of file mshr.cc.
References gem5::QueueEntry::blkAddr, gem5::QueueEntry::blkSize, hasTargets(), gem5::QueueEntry::isSecure, and gem5::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 319 of file mshr.hh.
References gem5::MSHR::TargetList::needsWritable, and targets.
Referenced by gem5::BaseCache::handleEvictions(), print(), gem5::BaseCache::sendMSHRQueuePacket(), and gem5::MSHR::TargetList::updateFlags().
|
inline |
Pop first target.
Definition at line 482 of file mshr.hh.
References DPRINTF, gem5::MSHR::TargetList::print(), and targets.
Referenced by gem5::MSHRQueue::forceDeallocateTarget(), and gem5::Cache::serviceMSHRTargets().
std::string gem5::MSHR::print | ( | ) | const |
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overheads in fast mode.
Definition at line 757 of file mshr.cc.
References print().
Referenced by allocateTarget(), and print().
|
overridevirtual |
Prints the contents of this MSHR for debugging.
Implements gem5::Printable.
Definition at line 731 of file mshr.cc.
References gem5::QueueEntry::_isUncacheable, allocOnFill(), gem5::QueueEntry::blkAddr, gem5::QueueEntry::blkSize, gem5::ccprintf(), deferredTargets, downstreamPending, hasFromCache(), gem5::QueueEntry::inService, isForward, gem5::QueueEntry::isSecure, needsWritable(), gem5::X86ISA::os, postDowngrade, postInvalidate, gem5::MSHR::TargetList::print(), and targets.
Referenced by gem5::MSHRQueue::deallocate(), and gem5::Cache::recvTimingSnoopReq().
bool gem5::MSHR::promoteDeferredTargets | ( | ) |
Definition at line 597 of file mshr.cc.
References gem5::curTick(), deferredTargets, gem5::QueueEntry::order, gem5::MSHR::TargetList::populateFlags(), gem5::QueueEntry::readyTime, gem5::ArmISA::t, and targets.
Referenced by gem5::MSHRQueue::forceDeallocateTarget(), and gem5::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 636 of file mshr.cc.
References gem5::MSHR::TargetList::clearDownstreamPending(), deferredTargets, downstreamPending, gem5::MSHR::TargetList::populateFlags(), gem5::RiscvISA::pred, and targets.
Referenced by promoteReadable(), and promoteWritable().
void gem5::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 659 of file mshr.cc.
References deferredTargets, gem5::MSHR::Target::FromCPU, hasPostInvalidate(), gem5::RiscvISA::pred, promoteIf(), and gem5::ArmISA::t.
Referenced by gem5::BaseCache::recvTimingResp().
void gem5::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 680 of file mshr.cc.
References deferredTargets, gem5::MSHR::Target::FromCPU, hasPostDowngrade(), hasPostInvalidate(), gem5::MSHR::TargetList::needsWritable, gem5::RiscvISA::pred, promoteIf(), gem5::Packet::req, gem5::ArmISA::t, and targets.
Referenced by gem5::BaseCache::recvTimingResp().
|
overridevirtual |
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entry type.
Implements gem5::QueueEntry.
Definition at line 725 of file mshr.cc.
References gem5::BaseCache::sendMSHRQueuePacket().
bool gem5::MSHR::trySatisfyFunctional | ( | PacketPtr | pkt | ) |
Definition at line 710 of file mshr.cc.
References gem5::QueueEntry::blkAddr, gem5::QueueEntry::blkSize, deferredTargets, gem5::Packet::isPrint(), gem5::QueueEntry::isSecure, targets, gem5::MSHR::TargetList::trySatisfyFunctional(), and gem5::Packet::trySatisfyFunctional().
void gem5::MSHR::updateLockedRMWReadTarget | ( | PacketPtr | pkt | ) |
Replaces the matching packet in the Targets list with a dummy packet to ensure the MSHR remains allocated until the corresponding locked write arrives.
pkt | The LockedRMWRead packet to be updated |
Definition at line 786 of file mshr.cc.
References gem5::MemCmd::LockedRMWReadReq, gem5::MipsISA::r, gem5::Packet::req, and targets.
Referenced by gem5::Cache::serviceMSHRTargets().
|
friend |
|
private |
Pointer to this MSHR on the allocated list.
Definition at line 391 of file mshr.hh.
Referenced by gem5::MSHRQueue::allocate().
|
private |
Definition at line 396 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 87 of file mshr.hh.
Referenced by gem5::MSHR::TargetList::add(), allocate(), clearDownstreamPending(), handleSnoop(), markInService(), print(), and promoteIf().
bool gem5::MSHR::isForward |
True if the entry is just a simple forward from an upper level.
Definition at line 127 of file mshr.hh.
Referenced by allocate(), allocateTarget(), print(), gem5::BaseCache::recvTimingResp(), gem5::BaseCache::sendMSHRQueuePacket(), and gem5::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 113 of file mshr.hh.
Referenced by isPendingModified(), and markInService().
|
private |
Did we snoop a read while waiting for data?
Definition at line 119 of file mshr.hh.
Referenced by handleSnoop(), hasPostDowngrade(), markInService(), and print().
|
private |
Did we snoop an invalidate while waiting for data?
Definition at line 116 of file mshr.hh.
Referenced by handleSnoop(), hasPostInvalidate(), markInService(), and print().
|
private |
Pointer to this MSHR on the ready list.
Definition at line 385 of file mshr.hh.
Referenced by gem5::MSHRQueue::allocate(), gem5::MSHRQueue::delay(), gem5::MSHRQueue::markInService(), gem5::MSHRQueue::markPending(), and gem5::MSHRQueue::moveToFront().
|
private |
List of all requests that match the address.
Definition at line 394 of file mshr.hh.
Referenced by allocate(), allocateTarget(), allocOnFill(), clearDownstreamPending(), deallocate(), extractServiceableTargets(), getNumTargets(), getTarget(), handleSnoop(), hasFromCache(), hasLockedRMWReadTarget(), hasTargets(), isCleaning(), isWholeLineWrite(), markInService(), needsWritable(), popTarget(), print(), promoteDeferredTargets(), promoteIf(), promoteWritable(), trySatisfyFunctional(), and updateLockedRMWReadTarget().
bool gem5::MSHR::wasWholeLineWrite |
Track if we sent this as a whole line write or not.
Definition at line 124 of file mshr.hh.
Referenced by allocate(), markInService(), gem5::BaseCache::recvTimingResp(), and gem5::Cache::serviceMSHRTargets().