gem5
|
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 | isPendingModified () const |
bool | hasPostInvalidate () const |
bool | hasPostDowngrade () const |
bool | sendPacket (Cache &cache) |
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entry type. More... | |
bool | allocOnFill () const |
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... | |
Target * | getTarget () |
Returns a reference to the first target. More... | |
void | popTarget () |
Pop first target. More... | |
bool | promoteDeferredTargets () |
void | promoteWritable () |
bool | checkFunctional (PacketPtr pkt) |
void | print (std::ostream &os, int verbosity=0, const std::string &prefix="") const |
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... | |
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 | 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 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 240 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, QueueEntry::inService, isForward, MSHR::TargetList::isReset(), QueueEntry::isSecure, Packet::isSecure(), Request::isUncacheable(), QueueEntry::order, QueueEntry::readyTime, Packet::req, and targets.
Add a request to the list of targets.
target | The target. |
Definition at line 303 of file mshr.cc.
References QueueEntry::_isUncacheable, MSHR::TargetList::add(), Packet::cmd, deferredTargets, MSHR::Target::FromCPU, MemCmd::HardPFReq, hasPostDowngrade(), hasPostInvalidate(), QueueEntry::inService, isForward, isPendingModified(), Packet::needsWritable(), replaceUpgrade(), and targets.
Referenced by Cache::recvTimingReq().
|
inline |
Definition at line 252 of file mshr.hh.
References MSHR::TargetList::allocOnFill, and targets.
Referenced by print(), Cache::recvTimingResp(), and MSHR::TargetList::updateFlags().
bool MSHR::checkFunctional | ( | PacketPtr | pkt | ) |
Definition at line 543 of file mshr.cc.
References QueueEntry::blkAddr, QueueEntry::blkSize, MSHR::TargetList::checkFunctional(), Packet::checkFunctional(), deferredTargets, Packet::isPrint(), QueueEntry::isSecure, and targets.
void MSHR::clearDownstreamPending | ( | ) |
Definition at line 264 of file mshr.cc.
References MSHR::TargetList::clearDownstreamPending(), downstreamPending, and targets.
Referenced by MSHR::TargetList::clearDownstreamPending().
void MSHR::deallocate | ( | ) |
Mark this MSHR as free.
Definition at line 291 of file mshr.cc.
References deferredTargets, QueueEntry::inService, MSHR::TargetList::isReset(), MSHR::TargetList::resetFlags(), and targets.
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 458 of file mshr.cc.
References Packet::cmd, MSHR::Target::FromCPU, MSHR::Target::FromPrefetcher, MSHR::Target::FromSnoop, MSHR::TargetList::populateFlags(), MemCmd::ReadRespWithInvalidate, and targets.
Referenced by Cache::recvTimingResp().
|
inline |
Returns the current number of allocated targets.
Definition at line 312 of file mshr.hh.
References deferredTargets, and targets.
Referenced by Cache::recvTimingReq(), and Cache::recvTimingSnoopReq().
|
inline |
Returns a reference to the first target.
Definition at line 339 of file mshr.hh.
References hasTargets(), and targets.
Referenced by Cache::recvTimingResp(), and Cache::sendMSHRQueuePacket().
Definition at line 345 of file mshr.cc.
References MSHR::TargetList::add(), QueueEntry::blkSize, Packet::cmd, curTick(), deferredTargets, downstreamPending, DPRINTF, MSHR::Target::FromSnoop, hasPostInvalidate(), QueueEntry::inService, Packet::isExpressSnoop(), Packet::isInvalidate(), isPendingModified(), Request::isUncacheable(), 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(), and targets.
Referenced by Cache::recvTimingSnoopReq().
|
inline |
Definition at line 246 of file mshr.hh.
References QueueEntry::inService, and postDowngrade.
Referenced by allocateTarget(), promoteWritable(), and Cache::recvTimingResp().
|
inline |
Definition at line 242 of file mshr.hh.
References QueueEntry::inService, and postInvalidate.
Referenced by allocateTarget(), handleSnoop(), promoteWritable(), and Cache::recvTimingResp().
|
inline |
Returns true if there are targets left.
Definition at line 333 of file mshr.hh.
References targets.
Referenced by MSHRQueue::forceDeallocateTarget(), and getTarget().
|
inline |
Definition at line 238 of file mshr.hh.
References QueueEntry::inService, and pendingModified.
Referenced by allocateTarget(), Cache::functionalAccess(), and handleSnoop().
void MSHR::markInService | ( | bool | pending_modified_resp | ) |
Definition at line 274 of file mshr.cc.
References MSHR::TargetList::clearDownstreamPending(), downstreamPending, QueueEntry::inService, MSHR::TargetList::needsWritable, pendingModified, postDowngrade, postInvalidate, and targets.
Referenced by MSHRQueue::markInService().
|
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 236 of file mshr.hh.
References MSHR::TargetList::needsWritable, and targets.
Referenced by Cache::allocateBlock(), print(), Cache::sendMSHRQueuePacket(), and MSHR::TargetList::updateFlags().
|
inline |
Pop first target.
Definition at line 348 of file mshr.hh.
References targets.
Referenced by MSHRQueue::forceDeallocateTarget().
|
virtual |
Prints the contents of this MSHR for debugging.
Implements Printable.
Definition at line 564 of file mshr.cc.
References QueueEntry::_isUncacheable, allocOnFill(), QueueEntry::blkAddr, QueueEntry::blkSize, ccprintf(), deferredTargets, downstreamPending, QueueEntry::inService, isForward, QueueEntry::isSecure, needsWritable(), postDowngrade, postInvalidate, MSHR::TargetList::print(), and targets.
Referenced by Cache::recvTimingSnoopReq().
std::string MSHR::print | ( | ) | const |
bool MSHR::promoteDeferredTargets | ( | ) |
Definition at line 491 of file mshr.cc.
References curTick(), deferredTargets, QueueEntry::order, MSHR::TargetList::populateFlags(), QueueEntry::readyTime, MSHR::TargetList::resetFlags(), and targets.
Referenced by MSHRQueue::forceDeallocateTarget(), and Cache::recvTimingResp().
void MSHR::promoteWritable | ( | ) |
Definition at line 518 of file mshr.cc.
References MSHR::TargetList::clearDownstreamPending(), deferredTargets, downstreamPending, hasPostDowngrade(), hasPostInvalidate(), MSHR::TargetList::needsWritable, MSHR::TargetList::resetFlags(), and targets.
Referenced by Cache::recvTimingResp().
|
virtual |
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entry type.
Implements QueueEntry.
Definition at line 558 of file mshr.cc.
References Cache::sendMSHRQueuePacket().
|
friend |
|
private |
Pointer to this MSHR on the allocated list.
|
private |
Definition at line 272 of file mshr.hh.
Referenced by allocate(), allocateTarget(), checkFunctional(), deallocate(), getNumTargets(), handleSnoop(), print(), promoteDeferredTargets(), and promoteWritable().
|
private |
Flag set by downstream caches.
Definition at line 76 of file mshr.hh.
Referenced by MSHR::TargetList::add(), allocate(), clearDownstreamPending(), handleSnoop(), markInService(), print(), and promoteWritable().
bool MSHR::isForward |
True if the entry is just a simple forward from an upper level.
Definition at line 113 of file mshr.hh.
Referenced by allocate(), allocateTarget(), print(), Cache::recvTimingResp(), and Cache::sendMSHRQueuePacket().
|
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 102 of file mshr.hh.
Referenced by isPendingModified(), and markInService().
|
private |
Did we snoop a read while waiting for data?
Definition at line 108 of file mshr.hh.
Referenced by handleSnoop(), hasPostDowngrade(), markInService(), and print().
|
private |
Did we snoop an invalidate while waiting for data?
Definition at line 105 of file mshr.hh.
Referenced by handleSnoop(), hasPostInvalidate(), markInService(), and print().
|
private |
Pointer to this MSHR on the ready list.
Definition at line 261 of file mshr.hh.
Referenced by MSHRQueue::markInService(), MSHRQueue::markPending(), and MSHRQueue::moveToFront().
|
private |
List of all requests that match the address.
Definition at line 270 of file mshr.hh.
Referenced by allocate(), allocateTarget(), allocOnFill(), checkFunctional(), clearDownstreamPending(), deallocate(), extractServiceableTargets(), getNumTargets(), getTarget(), handleSnoop(), hasTargets(), markInService(), needsWritable(), popTarget(), print(), promoteDeferredTargets(), and promoteWritable().