summaryrefslogtreecommitdiff
path: root/src/dev/net/dist_iface.hh
diff options
context:
space:
mode:
authorGabor Dozsa <gabor.dozsa@arm.com>2016-12-06 17:33:06 +0000
committerGabor Dozsa <gabor.dozsa@arm.com>2016-12-06 17:33:06 +0000
commitecf68fac40feb7dc5ba8eba5ebc7f07045b088bb (patch)
tree7b67fd36b1a81eed0ef49a95607aa467389f6fe4 /src/dev/net/dist_iface.hh
parent3ef797623abaeb93049d59c8e90ba57f2ee9c7e1 (diff)
downloadgem5-ecf68fac40feb7dc5ba8eba5ebc7f07045b088bb.tar.xz
dev: Fix race conditions at terminating dist-gem5 simulations
Two problems may arise when a distributed gem5 simulation terminates: (i) simulation thread(s) may get stuck in an incomplete synchronisation event which prohibits processing the simulation exit event; and (ii) a stale receiver thread may try to access objects that have already been deleted while exiting gem5. This patch terminates receive threads properly and aborts the processing of any incomplete synchronisation event. Change-Id: I72337aa12c7926cece00309640d478b61e55a429 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/dev/net/dist_iface.hh')
-rw-r--r--src/dev/net/dist_iface.hh28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/dev/net/dist_iface.hh b/src/dev/net/dist_iface.hh
index 20ac0989b..a56b9a3bb 100644
--- a/src/dev/net/dist_iface.hh
+++ b/src/dev/net/dist_iface.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 ARM Limited
+ * Copyright (c) 2015-2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -152,6 +152,10 @@ class DistIface : public Drainable, public Serializable
* Tick for the next periodic sync (if the event is not scheduled yet)
*/
Tick nextAt;
+ /**
+ * Flag is set if the sync is aborted (e.g. due to connection lost)
+ */
+ bool isAbort;
friend class SyncEvent;
@@ -166,16 +170,26 @@ class DistIface : public Drainable, public Serializable
void init(Tick start, Tick repeat);
/**
* Core method to perform a full dist sync.
+ *
+ * @return true if the sync completes, false if it gets aborted
*/
- virtual void run(bool same_tick) = 0;
+ virtual bool run(bool same_tick) = 0;
/**
* Callback when the receiver thread gets a sync ack message.
+ *
+ * @return false if the receiver thread needs to stop (e.g.
+ * simulation is to exit)
*/
- virtual void progress(Tick send_tick,
+ virtual bool progress(Tick send_tick,
Tick next_repeat,
ReqType do_ckpt,
ReqType do_exit,
ReqType do_stop_sync) = 0;
+ /**
+ * Abort processing an on-going sync event (in case of an error, e.g.
+ * lost connection to a peer gem5)
+ */
+ void abort();
virtual void requestCkpt(ReqType req) = 0;
virtual void requestExit(ReqType req) = 0;
@@ -207,8 +221,8 @@ class DistIface : public Drainable, public Serializable
SyncNode();
~SyncNode() {}
- void run(bool same_tick) override;
- void progress(Tick max_req_tick,
+ bool run(bool same_tick) override;
+ bool progress(Tick max_req_tick,
Tick next_repeat,
ReqType do_ckpt,
ReqType do_exit,
@@ -246,8 +260,8 @@ class DistIface : public Drainable, public Serializable
SyncSwitch(int num_nodes);
~SyncSwitch() {}
- void run(bool same_tick) override;
- void progress(Tick max_req_tick,
+ bool run(bool same_tick) override;
+ bool progress(Tick max_req_tick,
Tick next_repeat,
ReqType do_ckpt,
ReqType do_exit,