From: Polina Dudnik Date: Fri, 14 Aug 2009 19:06:14 +0000 (-0500) Subject: SMT atomics modifications: X-Git-Tag: Calvin_Submission~39^2~6 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b924fd16cf64f242aa4832c13f38fd96c7c1fa0;p=gem5.git SMT atomics modifications: don't allow enquing from other threads if servicing and atomic for a thread --- diff --git a/src/mem/ruby/libruby.hh b/src/mem/ruby/libruby.hh index 3b6e19c41..a73ff5cf4 100644 --- a/src/mem/ruby/libruby.hh +++ b/src/mem/ruby/libruby.hh @@ -31,10 +31,11 @@ struct RubyRequest { uint64_t pc; RubyRequestType type; RubyAccessMode access_mode; + unsigned proc_id; RubyRequest() {} - RubyRequest(uint64_t _paddr, uint8_t* _data, int _len, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode) - : paddr(_paddr), data(_data), len(_len), pc(_pc), type(_type), access_mode(_access_mode) + RubyRequest(uint64_t _paddr, uint8_t* _data, int _len, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, unsigned _proc_id = 0) + : paddr(_paddr), data(_data), len(_len), pc(_pc), type(_type), access_mode(_access_mode), proc_id(_proc_id) {} }; diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index a030fc7c2..cd079cdc3 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -61,6 +61,8 @@ void Sequencer::init(const vector & argv) m_instCache_ptr = NULL; m_dataCache_ptr = NULL; m_controller = NULL; + m_servicing_atomic = -1; + m_atomics_counter = 0; for (size_t i=0; i 0); + return false; + } + else { + if (request.type == RubyRequestType_RMW_Read) { + if (m_servicing_atomic == -1) { + assert(m_atomics_counter == 0); + m_servicing_atomic = (int)request.proc_id; + } + else { + assert(m_servicing_atomic == (int)request.proc_id); + } + m_atomics_counter++; + } + else if (request.type == RubyRequestType_RMW_Write) { + assert(m_servicing_atomic == (int)request.proc_id); + assert(m_atomics_counter > 0); + m_atomics_counter--; + if (m_atomics_counter == 0) { + m_servicing_atomic = -1; + } + } + } + return true; } @@ -438,7 +465,7 @@ void Sequencer::issueRequest(const RubyRequest& request) { } Address line_addr(request.paddr); line_addr.makeLineAddress(); - CacheMsg msg(line_addr, Address(request.paddr), ctype, Address(request.pc), amtype, request.len, PrefetchBit_No); + CacheMsg msg(line_addr, Address(request.paddr), ctype, Address(request.pc), amtype, request.len, PrefetchBit_No, request.proc_id); if (Debug::getProtocolTrace()) { g_system_ptr->getProfiler()->profileTransition("Seq", m_version, Address(request.paddr), diff --git a/src/mem/ruby/system/Sequencer.hh b/src/mem/ruby/system/Sequencer.hh index 9b55e9781..2b1f023c5 100644 --- a/src/mem/ruby/system/Sequencer.hh +++ b/src/mem/ruby/system/Sequencer.hh @@ -84,7 +84,7 @@ public: // called by Tester or Simics int64_t makeRequest(const RubyRequest & request); - bool isReady(const RubyRequest& request) const; + bool isReady(const RubyRequest& request); bool empty() const; void print(ostream& out) const; @@ -125,7 +125,8 @@ private: // Global outstanding request count, across all request tables int m_outstanding_count; bool m_deadlock_check_scheduled; - + int m_servicing_atomic; + int m_atomics_counter; }; // Output operator declaration