From: Andreas Hansson <andreas.hansson@arm.com>
Date: Fri, 1 Mar 2013 18:20:33 +0000 (-0500)
Subject: mem: Add check if SimpleDRAM nextReqEvent is scheduled
X-Git-Tag: stable_2013_06_16~73
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5bcb3075615d2dade3e51501d3f634178598428;p=gem5.git

mem: Add check if SimpleDRAM nextReqEvent is scheduled

This check covers a case where a retry is called from the SimpleDRAM
causing a new request to appear before the DRAM itself schedules a
nextReqEvent. By adding this check, the event is not scheduled twice.
---

diff --git a/src/mem/simple_dram.cc b/src/mem/simple_dram.cc
index 340a57088..90517ec62 100644
--- a/src/mem/simple_dram.cc
+++ b/src/mem/simple_dram.cc
@@ -396,8 +396,11 @@ SimpleDRAM::processWriteEvent()
     }
 
     // Once you're done emptying the write queue, check if there's
-    // anything in the read queue, and call schedule if required
-    schedule(nextReqEvent, busBusyUntil);
+    // anything in the read queue, and call schedule if required. The
+    // retry above could already have caused it to be scheduled, so
+    // first check
+    if (!nextReqEvent.scheduled())
+        schedule(nextReqEvent, busBusyUntil);
 }
 
 void