Go to the documentation of this file.
40 #include "debug/HtmMem.hh"
41 #include "debug/RubyPort.hh"
47 const HtmFailedInCacheReason ruby_ret_code)
49 switch (ruby_ret_code) {
50 case HtmFailedInCacheReason_NO_FAIL:
52 case HtmFailedInCacheReason_FAIL_SELF:
54 case HtmFailedInCacheReason_FAIL_REMOTE:
56 case HtmFailedInCacheReason_FAIL_OTHER:
59 panic(
"Invalid htm return code\n");
65 ADD_STAT(m_htm_transaction_cycles,
"number of cycles spent in an outer "
67 ADD_STAT(m_htm_transaction_instructions,
"number of instructions spent "
68 "in an outer transaction"),
69 ADD_STAT(m_htm_transaction_abort_cause,
"cause of htm transaction abort")
89 for (
unsigned cause_idx = 0; cause_idx < num_causes; ++cause_idx) {
103 const HtmCallbackMode
mode,
104 const HtmFailedInCacheReason htm_return_code)
110 if (
mode == HtmCallbackMode_HTM_CMD) {
124 uint8_t* dataptr = pkt->
getPtr<uint8_t>();
125 memset(dataptr, 0, pkt->
getSize());
126 *dataptr = (uint8_t) htm_return_code;
129 if (htm_return_code == HtmFailedInCacheReason_NO_FAIL) {
130 if (pkt->
req->isHTMStart()) {
133 DPRINTF(HtmMem,
"htmStart - htmUid=%u\n",
135 }
else if (pkt->
req->isHTMCommit()) {
140 Counter transaction_instructions =
143 transaction_instructions);
145 DPRINTF(HtmMem,
"htmCommit - htmUid=%u\n",
147 }
else if (pkt->
req->isHTMAbort()) {
150 auto cause_idx =
static_cast<int>(cause);
152 DPRINTF(HtmMem,
"htmAbort - reason=%s - htmUid=%u\n",
157 DPRINTF(HtmMem,
"HTM_CMD: fail - htmUid=%u\n",
163 }
else if (
mode == HtmCallbackMode_LD_FAIL ||
164 mode == HtmCallbackMode_ST_FAIL) {
170 while (!seq_req_list.empty()) {
179 if (request.
m_type == RubyRequestType_Store_Conditional) {
180 pkt->
req->setExtraData(0);
183 DPRINTF(HtmMem,
"%s_FAIL: size=%d - "
184 "addr=0x%lx - htmUid=%d\n",
185 (
mode == HtmCallbackMode_LD_FAIL) ?
"LD" :
"ST",
192 seq_req_list.pop_front();
195 if (seq_req_list.empty()) {
199 panic(
"unrecognised HTM callback mode\n");
209 .
name(
name() +
".htm_transaction_cycles")
210 .
desc(
"number of cycles spent in an outer transaction")
215 .
name(
name() +
".htm_transaction_instructions")
216 .
desc(
"number of instructions spent in an outer transaction")
222 .
name(
name() +
".htm_transaction_abort_cause")
223 .desc(
"cause of htm transaction abort")
227 for (
unsigned cause_idx = 0; cause_idx < num_causes; ++cause_idx) {
236 const HtmFailedInCacheReason htm_return_code)
248 assert(port !=
nullptr);
252 DPRINTF(HtmMem,
"HTM callback: start=%d, commit=%d, "
253 "cancel=%d, rc=%d\n",
254 pkt->
req->isHTMStart(), pkt->
req->isHTMCommit(),
255 pkt->
req->isHTMCancel(), htm_return_code);
284 for (; htm != htm_end; ++htm) {
289 panic(
"Possible Deadlock detected. Aborting!\n"
290 "version: %d m_htmCmdRequestTable: %d "
291 "current time: %u issue_time: %d difference: %d\n",
306 template <
class VALUE>
310 auto i = queue.begin();
311 auto end = queue.end();
314 for (;
i != end; ++
i)
335 RubyRequestType secondary_type)
342 return RequestStatus_BufferFull;
350 return RequestStatus_Ready;
void print(std::ostream &out) const override
virtual bool empty() const
void htmCallback(Addr, const HtmCallbackMode, const HtmFailedInCacheReason)
Counter m_htmstart_instruction
Addr makeLineAddress(Addr addr)
HTMSequencer(const RubyHTMSequencerParams &p)
Stats::Histogram m_htm_transaction_instructions
Histogram of instruction lengths of HTM transactions.
uint64_t Tick
Tick count type.
RequestPtr req
A pointer to the original request.
void schedTimingResp(PacketPtr pkt, Tick when)
Schedule the sending of a timing response.
std::unordered_map< Addr, std::list< SequencerRequest > > m_RequestTable
Stats::Vector m_htm_transaction_abort_cause
Causes for HTM transaction aborts.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
virtual void print(std::ostream &out) const
int64_t Counter
Statistics counter type.
virtual RequestStatus insertRequest(PacketPtr pkt, RubyRequestType primary_type, RubyRequestType secondary_type)
std::ostream & operator<<(std::ostream &out, const std::deque< VALUE > &queue)
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
bool needsResponse() const
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
HtmCacheFailure htmRetCodeConversion(const HtmFailedInCacheReason rc)
Htm return code conversion.
void regStats() override
Callback to set stat parameters.
void rubyHtmCallback(PacketPtr pkt, const HtmFailedInCacheReason fail_r)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
RequestStatus insertRequest(PacketPtr pkt, RubyRequestType primary_type, RubyRequestType secondary_type) override
const FlagsType dist
Print the distribution.
Derived & init(size_type size)
Set this vector to have the given size.
const FlagsType nozero
Don't print if this is zero.
uint64_t getHtmTransactionUid() const
If a packet/request originates in a CPU executing in transactional mode, i.e.
Stats::Histogram m_htm_transaction_cycles
Histogram of cycle latencies of HTM transactions.
virtual const std::string name() const
bool isDeviceMemAddr(PacketPtr pkt) const
Similar to isMemAddr but for devices.
Cycles m_deadlock_threshold
Cycles ticksToCycles(Tick t) const
const FlagsType pdf
Print the percent of the total that this entry represents.
void makeHtmTransactionalReqResponse(const HtmCacheFailure ret_code)
Communicates to the core that a packet was processed by the memory subsystem while running in transac...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
bool empty() const override
std::string htmFailureToStr(HtmFailureFaultCause cause)
Convert enum into string to be used for debug purposes.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Cycles is a wrapper class for representing cycle counts, i.e.
T * getPtr()
get a pointer to the data ptr.
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation.
std::deque< SequencerRequest * > m_htmCmdRequestTable
Tick curTick()
The universal simulation clock.
Histogram & init(size_type size)
Set the parameters of this histogram.
const FlagsType total
Print the total.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
bool isMemAddr(Addr addr) const
Check if a physical address is within a range of a memory that is part of the global address map.
const FlagsType nonan
Don't print if this is NAN.
#define panic(...)
This implements a cprintf based panic() function.
bool isHtmCmdRequest(RubyRequestType type)
Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17