gem5
v20.1.0.0
|
#include <mem_checker.hh>
Classes | |
class | ByteTracker |
The ByteTracker keeps track of transactions for the same byte – all outstanding reads, the completed reads (and what they observed) and write clusters (see WriteCluster). More... | |
class | Transaction |
The Transaction class captures the lifetimes of read and write operations, and the values they consumed or produced respectively. More... | |
class | WriteCluster |
The WriteCluster class captures sets of writes where all writes are overlapping with at least one other write. More... | |
Public Types | |
typedef uint64_t | Serial |
The Serial type is used to be able to uniquely identify a transaction as it passes through the system. More... | |
typedef std::list< Transaction > | TransactionList |
typedef std::list< WriteCluster > | WriteClusterList |
Public Types inherited from SimObject | |
typedef SimObjectParams | Params |
Public Member Functions | |
MemChecker (const MemCheckerParams *p) | |
virtual | ~MemChecker () |
Serial | startRead (Tick start, Addr addr, size_t size) |
Starts a read transaction. More... | |
Serial | startWrite (Tick start, Addr addr, size_t size, const uint8_t *data) |
Starts a write transaction. More... | |
bool | completeRead (Serial serial, Tick complete, Addr addr, size_t size, uint8_t *data) |
Completes a previously started read transaction. More... | |
void | completeWrite (Serial serial, Tick complete, Addr addr, size_t size) |
Completes a previously started write transaction. More... | |
void | abortWrite (Serial serial, Addr addr, size_t size) |
Aborts a previously started write transaction. More... | |
void | reset () |
Resets the entire checker. More... | |
void | reset (Addr addr, size_t size) |
Resets an address-range. More... | |
const std::string & | getErrorMessage () const |
In completeRead, if an error is encountered, this does not print nor cause an error, but instead should be handled by the caller. More... | |
Public Member Functions inherited from SimObject | |
const Params * | params () const |
SimObject (const Params *_params) | |
virtual | ~SimObject () |
virtual const std::string | name () const |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | regProbePoints () |
Register probe points for this object. More... | |
virtual void | regProbeListeners () |
Register probe listeners for this object. More... | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. More... | |
virtual Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) |
Get a port with a given name and index. More... | |
virtual void | startup () |
startup() is the final initialization call before simulation. More... | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. More... | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. More... | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from EventManager | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. More... | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
Public Member Functions inherited from Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Member Functions inherited from Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
Public Member Functions inherited from Stats::Group | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | regStats () |
Callback to set stat parameters. More... | |
virtual void | resetStats () |
Callback to reset stats. More... | |
virtual void | preDumpStats () |
Callback before stats are dumped. More... | |
void | addStat (Stats::Info *info) |
Register a stat with this group. More... | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. More... | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. More... | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. More... | |
const Info * | resolveStat (std::string name) const |
Resolve a stat by its name within this group. More... | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
Static Public Attributes | |
static const Serial | SERIAL_INITIAL = 0 |
Initial serial. More... | |
static const Tick | TICK_INITIAL = 0 |
The initial tick the system starts with. More... | |
static const Tick | TICK_FUTURE = MaxTick |
The maximum value that curTick() could ever return. More... | |
static const uint8_t | DATA_INITIAL = 0x00 |
Initial data value. More... | |
Private Member Functions | |
ByteTracker * | getByteTracker (Addr addr) |
Returns the instance of ByteTracker for the requested location. More... | |
Private Attributes | |
std::string | errorMessage |
Detailed error message of the last violation in completeRead. More... | |
Serial | nextSerial |
Next distinct serial to be assigned to the next transaction to be started. More... | |
std::unordered_map< Addr, ByteTracker > | byte_trackers |
Maintain a map of address --> byte-tracker. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from SimObject | |
static void | serializeAll (CheckpointOut &cp) |
Serialize all SimObjects in the system. More... | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. More... | |
Static Public Member Functions inherited from Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
Serializes all the SimObjects. More... | |
static void | unserializeGlobals (CheckpointIn &cp) |
Protected Member Functions inherited from Drainable | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
Protected Attributes inherited from SimObject | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Verifies that reads observe the values from permissible writes. As memory operations have a start and completion time, we consider them as transactions which have a start and end time. Because of this, the lifetimes of transactions of memory operations may be overlapping – we assume that if there is overlap between writes, they could be reordered by the memory subsystem, and a read could any of these. For more detail, see comments of inExpectedData().
For simplicity, the permissible values a read can observe are only dependent on the particular location, and we do not consider the effect of multi-byte reads or writes. This precludes us from discovering single-copy atomicity violations.
Definition at line 69 of file mem_checker.hh.
typedef uint64_t MemChecker::Serial |
The Serial type is used to be able to uniquely identify a transaction as it passes through the system.
It's value is independent of any other system counters.
Definition at line 77 of file mem_checker.hh.
Definition at line 192 of file mem_checker.hh.
Definition at line 193 of file mem_checker.hh.
|
inline |
Definition at line 372 of file mem_checker.hh.
|
inlinevirtual |
Definition at line 377 of file mem_checker.hh.
|
inline |
Aborts a previously started write transaction.
serial | A serial of a write that was previously started and matches the address of the previously started write. |
addr | Address for write. |
size | The size of the data written. |
Definition at line 555 of file mem_checker.hh.
References MemChecker::ByteTracker::abortWrite(), addr, DPRINTF, getByteTracker(), and ArmISA::i.
Referenced by MemCheckerMonitor::recvTimingResp().
bool MemChecker::completeRead | ( | MemChecker::Serial | serial, |
Tick | complete, | ||
Addr | addr, | ||
size_t | size, | ||
uint8_t * | data | ||
) |
Completes a previously started read transaction.
serial | A serial of a read that was previously started and matches the address of the previously started read. |
complete | Tick we received the response from the memory subsystem. |
addr | Address for read. |
size | Size of data received. |
data | Pointer to size bytes, containing data received. |
Definition at line 295 of file mem_checker.cc.
References addr, MemChecker::ByteTracker::completeRead(), csprintf(), data, DPRINTF, errorMessage, getByteTracker(), ArmISA::i, ArmISA::j, and MemChecker::ByteTracker::lastExpectedData().
Referenced by MemCheckerMonitor::recvTimingResp().
|
inline |
Completes a previously started write transaction.
serial | A serial of a write that was previously started and matches the address of the previously started write. |
complete | Tick we received acknowledgment of completion from the memory subsystem. |
addr | Address for write. |
size | The size of the data written. |
Definition at line 542 of file mem_checker.hh.
References addr, MemChecker::ByteTracker::completeWrite(), DPRINTF, getByteTracker(), and ArmISA::i.
Referenced by MemCheckerMonitor::recvTimingResp().
|
inlineprivate |
Returns the instance of ByteTracker for the requested location.
Definition at line 477 of file mem_checker.hh.
References addr, and byte_trackers.
Referenced by abortWrite(), completeRead(), completeWrite(), startRead(), and startWrite().
|
inline |
In completeRead, if an error is encountered, this does not print nor cause an error, but instead should be handled by the caller.
However, to record information about the cause of an error, completeRead creates an errorMessage. This function returns the last error that was detected in completeRead.
Definition at line 471 of file mem_checker.hh.
References errorMessage.
Referenced by MemCheckerMonitor::recvTimingResp().
|
inline |
Resets the entire checker.
Note that if there are transactions in-flight, this will cause a warning to be issued if these are completed after the reset. This does not reset nextSerial to avoid such a race condition: where a transaction started before a reset with serial S, then reset() was called, followed by a start of a transaction with the same serial S and then receive a completion of the transaction before the reset with serial S.
Definition at line 449 of file mem_checker.hh.
References byte_trackers.
Referenced by MemCheckerMonitor::recvFunctional(), and MemCheckerMonitor::recvFunctionalSnoop().
void MemChecker::reset | ( | Addr | addr, |
size_t | size | ||
) |
Resets an address-range.
This may be useful in case other unmonitored parts of the system caused modification to this memory, but we cannot track their written values.
addr | Address base. |
size | Size of range to be invalidated. |
Definition at line 340 of file mem_checker.cc.
References addr, byte_trackers, and ArmISA::i.
|
inline |
Starts a read transaction.
start | Tick this read was sent to the memory subsystem. |
addr | Address for read. |
size | Size of data expected. |
Definition at line 514 of file mem_checker.hh.
References addr, DPRINTF, getByteTracker(), ArmISA::i, nextSerial, and MemChecker::ByteTracker::startRead().
Referenced by MemCheckerMonitor::recvTimingReq().
|
inline |
Starts a write transaction.
start | Tick when this write was sent to the memory subsystem. |
addr | Address for write. |
size | Size of data to be written. |
data | Pointer to size bytes, containing data to be written. |
Definition at line 528 of file mem_checker.hh.
References addr, data, DPRINTF, getByteTracker(), ArmISA::i, nextSerial, and MemChecker::ByteTracker::startWrite().
Referenced by MemCheckerMonitor::recvTimingReq().
|
private |
Maintain a map of address --> byte-tracker.
Per-byte entries are initialized as needed.
The required space for this obviously grows with the number of distinct addresses used for a particular workload. The used size is independent on the number of nodes in the system, those may affect the size of per-byte tracking information.
Access via getByteTracker()!
Definition at line 510 of file mem_checker.hh.
Referenced by getByteTracker(), and reset().
|
static |
Initial data value.
No requirements.
Definition at line 96 of file mem_checker.hh.
Referenced by MemChecker::ByteTracker::ByteTracker().
|
private |
Detailed error message of the last violation in completeRead.
Definition at line 485 of file mem_checker.hh.
Referenced by completeRead(), and getErrorMessage().
|
private |
Next distinct serial to be assigned to the next transaction to be started.
Definition at line 497 of file mem_checker.hh.
Referenced by startRead(), and startWrite().
|
static |
Initial serial.
Definition at line 79 of file mem_checker.hh.
Referenced by MemChecker::ByteTracker::ByteTracker().
The maximum value that curTick() could ever return.
Definition at line 91 of file mem_checker.hh.
Referenced by MemChecker::WriteCluster::completeWrite(), MemChecker::WriteCluster::isComplete(), MemChecker::ByteTracker::startRead(), and MemChecker::WriteCluster::startWrite().
|
static |
The initial tick the system starts with.
Must not be larger than the minimum value that curTick() could return at any time in the system's execution.
Definition at line 86 of file mem_checker.hh.
Referenced by MemChecker::ByteTracker::ByteTracker(), and MemChecker::ByteTracker::inExpectedData().