diff -r 2306d524ec1c -r 725a5a991352 src/mem/ruby/system/RubyPort.cc --- a/src/mem/ruby/system/RubyPort.cc Fri Aug 31 18:41:03 2012 -0500 +++ b/src/mem/ruby/system/RubyPort.cc Fri Aug 31 23:35:40 2012 -0500 @@ -527,7 +527,7 @@ { //If we weren't able to drain before, we might be able to now. if (drainEvent != NULL) { - unsigned int drainCount = getDrainCount(drainEvent); + unsigned int drainCount = outstandingCount(); DPRINTF(Drain, "Drain count: %u\n", drainCount); if (drainCount == 0) { DPRINTF(Drain, "RubyPort done draining, processing drain event\n"); @@ -547,7 +547,7 @@ // The outstandingCount is the number of requests outstanding and thus the // number of times M5's timing port will process the drain event. // - count += outstandingCount(); + count += (outstandingCount() > 0) ? 1 : 0; DPRINTF(Config, "outstanding count %d\n", outstandingCount()); @@ -594,6 +594,7 @@ return count; } + drainEvent = NULL; changeState(SimObject::Drained); return 0; } diff -r 2306d524ec1c -r 725a5a991352 src/mem/ruby/system/Sequencer.cc --- a/src/mem/ruby/system/Sequencer.cc Fri Aug 31 18:41:03 2012 -0500 +++ b/src/mem/ruby/system/Sequencer.cc Fri Aug 31 23:35:40 2012 -0500 @@ -85,6 +85,8 @@ void Sequencer::wakeup() { + assert(getState() != SimObject::Draining); + // Check for deadlock of any of the requests Time current_time = g_system_ptr->getTime(); @@ -208,7 +210,9 @@ (m_writeRequestTable.size() + m_readRequestTable.size())); // See if we should schedule a deadlock check - if (deadlockCheckEvent.scheduled() == false) { + if (deadlockCheckEvent.scheduled() == false && + getState() != SimObject::Draining) { + schedule(deadlockCheckEvent, m_deadlock_threshold * g_system_ptr->getClock() + curTick());