gem5  v20.1.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
MSHR Class Reference

Miss Status and handling Register. More...

#include <mshr.hh>

Inheritance diagram for MSHR:
QueueEntry Printable Packet::SenderState

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::TargetgetTarget () 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
SenderStatepredecessor
 

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...
 

Detailed Description

Miss Status and handling Register.

This class keeps all the information needed to handle a cache miss including a list of target requests.

See also
gem5 Memory System

Definition at line 69 of file mshr.hh.

Member Typedef Documentation

◆ Iterator

typedef List::iterator MSHR::Iterator

MSHR list iterator.

Definition at line 303 of file mshr.hh.

◆ List

A list of MSHRs.

Definition at line 301 of file mshr.hh.

Constructor & Destructor Documentation

◆ MSHR()

MSHR::MSHR ( )

A simple constructor.

Definition at line 60 of file mshr.cc.

Member Function Documentation

◆ allocate()

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.

Parameters
blk_addrThe address of the block.
blk_sizeThe number of bytes to request.
pktThe original miss.
when_readyWhen should the MSHR be ready to act upon.
_orderThe logical order of this MSHR
alloc_on_fillShould 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().

◆ allocateTarget()

void MSHR::allocateTarget ( PacketPtr  target,
Tick  when,
Counter  order,
bool  alloc_on_fill 
)

◆ allocOnFill()

bool MSHR::allocOnFill ( ) const
inline

Definition at line 332 of file mshr.hh.

References MSHR::TargetList::allocOnFill, and targets.

Referenced by print(), BaseCache::recvTimingResp(), and MSHR::TargetList::updateFlags().

◆ clearDownstreamPending()

void MSHR::clearDownstreamPending ( )

◆ conflictAddr()

bool MSHR::conflictAddr ( const QueueEntry entry) const
overridevirtual

Check if given entry's packets conflict with this' entries packets.

Parameters
entryOther entry to compare against.
Returns
True if entry matches given information.

Implements QueueEntry.

Definition at line 749 of file mshr.cc.

References QueueEntry::blkAddr, hasTargets(), QueueEntry::isSecure, and QueueEntry::matchBlockAddr().

◆ deallocate()

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.

◆ delay()

void MSHR::delay ( Tick  delay_ticks)
inline

Adds a delay relative to the current tick to the current MSHR.

Parameters
delay_ticksthe desired delay in ticks

Definition at line 490 of file mshr.hh.

References curTick(), and QueueEntry::readyTime.

Referenced by MSHRQueue::delay().

◆ extractServiceableTargets()

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).

Parameters
pktThe 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().

◆ getNumTargets()

int MSHR::getNumTargets ( ) const
inline

Returns the current number of allocated targets.

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().

◆ getTarget()

QueueEntry::Target* MSHR::getTarget ( )
inlineoverridevirtual

Returns a reference to the first target.

Returns
A pointer 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().

◆ handleSnoop()

bool MSHR::handleSnoop ( PacketPtr  target,
Counter  order 
)

◆ hasFromCache()

bool MSHR::hasFromCache ( ) const
inline

Determine if there are non-deferred requests from other caches.

Returns
true if any of the targets is from another cache

Definition at line 341 of file mshr.hh.

References MSHR::TargetList::hasFromCache, and targets.

Referenced by print(), and MSHR::TargetList::updateFlags().

◆ hasPostDowngrade()

bool MSHR::hasPostDowngrade ( ) const
inline

Definition at line 326 of file mshr.hh.

References QueueEntry::inService, and postDowngrade.

Referenced by allocateTarget(), promoteWritable(), and Cache::serviceMSHRTargets().

◆ hasPostInvalidate()

bool MSHR::hasPostInvalidate ( ) const
inline

◆ hasTargets()

bool MSHR::hasTargets ( ) const
inline

Returns true if there are targets left.

Returns
true if there are targets

Definition at line 443 of file mshr.hh.

References targets.

Referenced by conflictAddr(), MSHRQueue::forceDeallocateTarget(), getTarget(), and matchBlockAddr().

◆ isCleaning()

bool MSHR::isCleaning ( ) const
inline

Definition at line 313 of file mshr.hh.

References Packet::isClean(), and targets.

Referenced by BaseCache::handleEvictions().

◆ isPendingModified()

bool MSHR::isPendingModified ( ) const
inline

Definition at line 318 of file mshr.hh.

References QueueEntry::inService, and pendingModified.

Referenced by allocateTarget(), BaseCache::functionalAccess(), and handleSnoop().

◆ isWholeLineWrite()

bool MSHR::isWholeLineWrite ( ) const
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().

◆ markInService()

void MSHR::markInService ( bool  pending_modified_resp)

◆ matchBlockAddr() [1/2]

bool MSHR::matchBlockAddr ( const Addr  addr,
const bool  is_secure 
) const
overridevirtual

Check if entry corresponds to the one being looked for.

Parameters
addrAddress to match against.
is_secureWhether the target should be in secure space or not.
Returns
True if entry matches given information.

Implements QueueEntry.

Definition at line 735 of file mshr.cc.

References addr, QueueEntry::blkAddr, hasTargets(), and QueueEntry::isSecure.

◆ matchBlockAddr() [2/2]

bool MSHR::matchBlockAddr ( const PacketPtr  pkt) const
overridevirtual

Check if entry contains a packet that corresponds to the one being looked for.

Parameters
pktThe packet to search for.
Returns
True if any of its targets' packets matches the given one.

Implements QueueEntry.

Definition at line 742 of file mshr.cc.

References QueueEntry::blkAddr, QueueEntry::blkSize, hasTargets(), QueueEntry::isSecure, and Packet::matchBlockAddr().

◆ needsWritable()

bool MSHR::needsWritable ( ) const
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().

◆ popTarget()

void MSHR::popTarget ( )
inline

Pop first target.

Definition at line 458 of file mshr.hh.

References targets.

Referenced by MSHRQueue::forceDeallocateTarget().

◆ print() [1/2]

std::string MSHR::print ( ) const

A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overheads in fast mode.

Returns
string with mshr fields + [deferred]targets

Definition at line 727 of file mshr.cc.

◆ print() [2/2]

void MSHR::print ( std::ostream &  os,
int  verbosity = 0,
const std::string &  prefix = "" 
) const
overridevirtual

◆ promoteDeferredTargets()

bool MSHR::promoteDeferredTargets ( )

◆ promoteIf()

void MSHR::promoteIf ( const std::function< bool(Target &)> &  pred)
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.

Parameters
predA 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().

◆ promoteReadable()

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().

◆ promoteWritable()

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().

◆ sendPacket()

bool MSHR::sendPacket ( BaseCache cache)
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().

◆ trySatisfyFunctional()

bool MSHR::trySatisfyFunctional ( PacketPtr  pkt)

Friends And Related Function Documentation

◆ MSHRQueue

friend class MSHRQueue
friend

Definition at line 77 of file mshr.hh.

◆ Queue

template<typename Entry >
friend class Queue
friend

Consider the queues friends to avoid making everything public.

Definition at line 76 of file mshr.hh.

Member Data Documentation

◆ allocIter

Iterator MSHR::allocIter
private

Pointer to this MSHR on the allocated list.

See also
MissQueue, MSHRQueue::allocatedList

Definition at line 367 of file mshr.hh.

Referenced by MSHRQueue::allocate().

◆ deferredTargets

TargetList MSHR::deferredTargets
private

◆ downstreamPending

bool MSHR::downstreamPending
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().

◆ isForward

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().

◆ pendingModified

bool MSHR::pendingModified
private

Here we use one flag to track both if:

  1. We are going to become owner or not, i.e., we will get the block in an ownership state (Owned or Modified) with BlkDirty set. This determines whether or not we are going to become the responder and ordering point for future requests that we snoop.
  2. We know that we are going to get a writable block, i.e. we will get the block in writable state (Exclusive or Modified state) with BlkWritable set. That determines whether additional targets with needsWritable set will be able to be satisfied, or if not should be put on the deferred list to possibly wait for another request that does give us writable access.

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().

◆ postDowngrade

bool MSHR::postDowngrade
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().

◆ postInvalidate

bool MSHR::postInvalidate
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().

◆ readyIter

Iterator MSHR::readyIter
private

Pointer to this MSHR on the ready list.

See also
MissQueue, MSHRQueue::readyList

Definition at line 361 of file mshr.hh.

Referenced by MSHRQueue::allocate(), MSHRQueue::delay(), MSHRQueue::markInService(), MSHRQueue::markPending(), and MSHRQueue::moveToFront().

◆ targets

TargetList MSHR::targets
private

◆ wasWholeLineWrite

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().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:28 for gem5 by doxygen 1.8.17