From faf823f947f2318687f9c9e2e05ba6ab919abe14 Mon Sep 17 00:00:00 2001 From: Polina Dudnik Date: Mon, 13 Jul 2009 11:34:38 -0500 Subject: [PATCH] Moved the lock check and clearing the lock into makeRequest --- src/mem/ruby/system/Sequencer.cc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc index dc65d6fc6..db60bb11a 100644 --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -264,19 +264,6 @@ void Sequencer::writeCallback(const Address& address, DataBlock& data) { if (request->ruby_request.type == RubyRequestType_RMW_Read) { m_dataCache_ptr->setLocked(address, m_version); } - else if (request->ruby_request.type == RubyRequestType_RMW_Write) { - if (m_dataCache_ptr->isLocked(address, m_version)) { - // if we are holding the lock for this - request->ruby_request.atomic_success = true; - m_dataCache_ptr->clearLocked(address); - } - else { - // if we are not holding the lock for this - request->ruby_request.atomic_success = false; - } - - // can have livelock - } hitCallback(request, data); } @@ -367,6 +354,8 @@ bool Sequencer::empty() const { return (m_writeRequestTable.size() == 0) && (m_readRequestTable.size() == 0); } + +// -2 means that the LLSC failed int64_t Sequencer::makeRequest(const RubyRequest & request) { assert(Address(request.paddr).getOffset() + request.len <= RubySystem::getBlockSizeBytes()); @@ -375,6 +364,14 @@ int64_t Sequencer::makeRequest(const RubyRequest & request) SequencerRequest *srequest = new SequencerRequest(request, id, g_eventQueue_ptr->getTime()); bool found = insertRequest(srequest); if (!found) + if (request.type == RubyRequestType_RMW_Write) { + if (!m_dataCache_ptr->isLocked(line_address(Address(request.paddr)), m_version)) { + return -2; + } + else { + m_dataCache_ptr->clearLocked(line_address(Address(request.paddr))); + } + } issueRequest(request); // TODO: issue hardware prefetches here -- 2.30.2