gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Public Attributes | 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 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...
 
TargetgetTarget ()
 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
SenderStatepredecessor
 

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 63 of file mshr.hh.

Member Typedef Documentation

typedef List::iterator MSHR::Iterator

MSHR list iterator.

Definition at line 228 of file mshr.hh.

A list of MSHRs.

Definition at line 226 of file mshr.hh.

Constructor & Destructor Documentation

MSHR::MSHR ( )

A simple constructor.

Definition at line 65 of file mshr.cc.

Member Function Documentation

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

void MSHR::allocateTarget ( PacketPtr  target,
Tick  when,
Counter  order,
bool  alloc_on_fill 
)
bool MSHR::allocOnFill ( ) const
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)
void MSHR::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).

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

int MSHR::getNumTargets ( ) const
inline

Returns the current number of allocated targets.

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

Target* MSHR::getTarget ( )
inline

Returns a reference to the first target.

Returns
A pointer to the first target.

Definition at line 339 of file mshr.hh.

References hasTargets(), and targets.

Referenced by Cache::recvTimingResp(), and Cache::sendMSHRQueuePacket().

bool MSHR::handleSnoop ( PacketPtr  target,
Counter  order 
)
bool MSHR::hasPostDowngrade ( ) const
inline

Definition at line 246 of file mshr.hh.

References QueueEntry::inService, and postDowngrade.

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

bool MSHR::hasPostInvalidate ( ) const
inline

Definition at line 242 of file mshr.hh.

References QueueEntry::inService, and postInvalidate.

Referenced by allocateTarget(), handleSnoop(), promoteWritable(), and Cache::recvTimingResp().

bool MSHR::hasTargets ( ) const
inline

Returns true if there are targets left.

Returns
true if there are targets

Definition at line 333 of file mshr.hh.

References targets.

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

bool MSHR::isPendingModified ( ) const
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)
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 236 of file mshr.hh.

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

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

void MSHR::popTarget ( )
inline

Pop first target.

Definition at line 348 of file mshr.hh.

References targets.

Referenced by MSHRQueue::forceDeallocateTarget().

void MSHR::print ( std::ostream &  os,
int  verbosity = 0,
const std::string &  prefix = "" 
) const
virtual
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 589 of file mshr.cc.

bool MSHR::promoteDeferredTargets ( )
void MSHR::promoteWritable ( )
bool MSHR::sendPacket ( Cache cache)
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().

Friends And Related Function Documentation

friend class MSHRQueue
friend

Definition at line 71 of file mshr.hh.

template<typename Entry >
friend class Queue
friend

Consider the queues friends to avoid making everything public.

Definition at line 70 of file mshr.hh.

Member Data Documentation

Iterator MSHR::allocIter
private

Pointer to this MSHR on the allocated list.

See Also
MissQueue, MSHRQueue::allocatedList

Definition at line 267 of file mshr.hh.

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

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 102 of file mshr.hh.

Referenced by isPendingModified(), and markInService().

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

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

Iterator MSHR::readyIter
private

Pointer to this MSHR on the ready list.

See Also
MissQueue, MSHRQueue::readyList

Definition at line 261 of file mshr.hh.

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

TargetList MSHR::targets
private

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

Generated on Fri Jun 9 2017 13:04:15 for gem5 by doxygen 1.8.6