cpu: Fix rescheduling of progress check events
authorTiago Muck <tiago.muck@arm.com>
Thu, 24 Jan 2019 20:59:04 +0000 (14:59 -0600)
committerTiago Mück <tiago.muck@arm.com>
Thu, 30 May 2019 16:02:27 +0000 (16:02 +0000)
noRequestEvent needs to be rescheduled on recvRetry, otherwise the timeout
may be triggered even though packets are being eventually sent.
noResponseEvent scheduling is also fixed. This timeout should not be
active when we are not expecting a response.

Change-Id: If9edb75b5b803caf9f99bf41ea3948b15a3f3d71
Signed-off-by: Tiago Muck <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18793
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/cpu/testers/memtest/memtest.cc

index 93a6ac6b9e64eb4c4727a464437629a183366c71..742cf3b265eef022e7daf189ff27ea87eb093cae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 ARM Limited
+ * Copyright (c) 2015, 2019 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -120,7 +120,6 @@ MemTest::MemTest(const Params *p)
     // kick things into action
     schedule(tickEvent, curTick());
     schedule(noRequestEvent, clockEdge(progressCheck));
-    schedule(noResponseEvent, clockEdge(progressCheck));
 }
 
 Port &
@@ -189,8 +188,12 @@ MemTest::completeRequest(PacketPtr pkt, bool functional)
     // the packet will delete the data
     delete pkt;
 
-    // finally shift the response timeout forward
-    reschedule(noResponseEvent, clockEdge(progressCheck), true);
+    // finally shift the response timeout forward if we are still
+    // expecting responses; deschedule it otherwise
+    if (outstandingAddrs.size() != 0)
+        reschedule(noResponseEvent, clockEdge(progressCheck));
+    else if (noResponseEvent.scheduled())
+        deschedule(noResponseEvent);
 }
 
 void
@@ -303,6 +306,10 @@ MemTest::tick()
     } else {
         DPRINTF(MemTest, "Waiting for retry\n");
     }
+
+    // Schedule noResponseEvent now if we are expecting a response
+    if (!noResponseEvent.scheduled() && (outstandingAddrs.size() != 0))
+        schedule(noResponseEvent, clockEdge(progressCheck));
 }
 
 void
@@ -327,6 +334,7 @@ MemTest::recvRetry()
         retryPkt = nullptr;
         // kick things into action again
         schedule(tickEvent, clockEdge(interval));
+        reschedule(noRequestEvent, clockEdge(progressCheck), true);
     }
 }