summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2016-05-26 11:56:24 +0100
committerAndreas Hansson <andreas.hansson@arm.com>2016-05-26 11:56:24 +0100
commitd023b7e8dba012298d6396ae4734755ce1f194d1 (patch)
tree005786bcb0cacb7c19be628a1cea09e89190f90e /src/cpu
parent4ff4f9c531feb99561105117b6ceeb4eb85d7829 (diff)
downloadgem5-d023b7e8dba012298d6396ae4734755ce1f194d1.tar.xz
cpu: Add a basic progress check to the TrafficGen
This patch adds a progress check to the TrafficGen so that it is easier to detect deadlock scenarios where the generator gets stuck waiting for a retry, and makes no further progress. Change-Id: Ifb8779ad0939f52c0518d0e867bac73f99b82e2b Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Radhika Jagtap <radhika.jagtap@arm.com>
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/testers/traffic_gen/TrafficGen.py8
-rw-r--r--src/cpu/testers/traffic_gen/traffic_gen.cc14
-rw-r--r--src/cpu/testers/traffic_gen/traffic_gen.hh18
3 files changed, 37 insertions, 3 deletions
diff --git a/src/cpu/testers/traffic_gen/TrafficGen.py b/src/cpu/testers/traffic_gen/TrafficGen.py
index f29cedb3a..1a6a6359c 100644
--- a/src/cpu/testers/traffic_gen/TrafficGen.py
+++ b/src/cpu/testers/traffic_gen/TrafficGen.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2012 ARM Limited
+# Copyright (c) 2012, 2016 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -77,3 +77,9 @@ class TrafficGen(MemObject):
# are not immediately accepted
elastic_req = Param.Bool(False,
"Slow down requests in case of backpressure")
+
+ # Let the user know if we have waited for a retry and not made any
+ # progress for a long period of time. The default value is
+ # somewhat arbitrary and may well have to be tuned.
+ progress_check = Param.Latency('1ms', "Time before exiting " \
+ "due to lack of progress")
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc b/src/cpu/testers/traffic_gen/traffic_gen.cc
index a405351ed..fbb26baa8 100644
--- a/src/cpu/testers/traffic_gen/traffic_gen.cc
+++ b/src/cpu/testers/traffic_gen/traffic_gen.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2013 ARM Limited
+ * Copyright (c) 2012-2013, 2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -57,6 +57,8 @@ TrafficGen::TrafficGen(const TrafficGenParams* p)
masterID(system->getMasterId(name())),
configFile(p->config_file),
elasticReq(p->elastic_req),
+ progressCheck(p->progress_check),
+ noProgressEvent(this),
nextTransitionTick(0),
nextPacketTick(0),
currState(0),
@@ -179,6 +181,9 @@ TrafficGen::unserialize(CheckpointIn &cp)
void
TrafficGen::update()
{
+ // shift our progress-tracking event forward
+ reschedule(noProgressEvent, curTick() + progressCheck, true);
+
// if we have reached the time for the next state transition, then
// perform the transition
if (curTick() >= nextTransitionTick) {
@@ -512,6 +517,13 @@ TrafficGen::recvReqRetry()
}
void
+TrafficGen::noProgress()
+{
+ fatal("TrafficGen %s spent %llu ticks without making progress",
+ name(), progressCheck);
+}
+
+void
TrafficGen::regStats()
{
// Initialise all the stats
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.hh b/src/cpu/testers/traffic_gen/traffic_gen.hh
index 914b4ac09..0715c5965 100644
--- a/src/cpu/testers/traffic_gen/traffic_gen.hh
+++ b/src/cpu/testers/traffic_gen/traffic_gen.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2013 ARM Limited
+ * Copyright (c) 2012-2013, 2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -94,6 +94,11 @@ class TrafficGen : public MemObject
*/
void recvReqRetry();
+ /**
+ * Method to inform the user we have made no progress.
+ */
+ void noProgress();
+
/** Struct to represent a probabilistic transition during parsing. */
struct Transition {
uint32_t from;
@@ -123,6 +128,17 @@ class TrafficGen : public MemObject
*/
const bool elasticReq;
+ /**
+ * Time to tolerate waiting for retries (not making progress),
+ * until we declare things broken.
+ */
+ const Tick progressCheck;
+
+ /**
+ * Event to keep track of our progress, or lack thereof.
+ */
+ EventWrapper<TrafficGen, &TrafficGen::noProgress> noProgressEvent;
+
/** Time of next transition */
Tick nextTransitionTick;