changeset 0b2aaf6f5c78 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=0b2aaf6f5c78
description:
dev: Exit correctly in dist-gem5
The receiver thread in dist_iface is allowed to directly exit the
simulation.
This can cause exit to be called twice if the main thread
simultaneously wants
to exit the simulation. Therefore, have the receiver thread enqueue a
request
to exit on the primary event queue for the main simulation thread to
handle.
diffstat:
src/dev/net/dist_iface.cc | 8 ++++----
src/dev/net/tcp_iface.cc | 5 ++---
2 files changed, 6 insertions(+), 7 deletions(-)
diffs (33 lines):
diff -r 3e9314ddf012 -r 0b2aaf6f5c78 src/dev/net/dist_iface.cc
--- a/src/dev/net/dist_iface.cc Tue Sep 13 23:06:32 2016 -0400
+++ b/src/dev/net/dist_iface.cc Tue Sep 13 23:08:34 2016 -0400
@@ -610,10 +610,10 @@
// because one of them called m5 exit. So we stop here.
// Grab the eventq lock to stop the simulation thread
curEventQueue()->lock();
- exit_message("info",
- 0,
- "Message server closed connection, "
- "simulation is exiting");
+ exitSimLoop("Message server closed connection, simulator "
+ "is exiting");
+ curEventQueue()->unlock();
+ break;
}
// We got a valid dist header packet, let's process it
diff -r 3e9314ddf012 -r 0b2aaf6f5c78 src/dev/net/tcp_iface.cc
--- a/src/dev/net/tcp_iface.cc Tue Sep 13 23:06:32 2016 -0400
+++ b/src/dev/net/tcp_iface.cc Tue Sep 13 23:08:34 2016 -0400
@@ -267,9 +267,8 @@
ret = ::send(sock, buf, length, MSG_NOSIGNAL);
if (ret < 0) {
if (errno == ECONNRESET || errno == EPIPE) {
- inform("send(): %s", strerror(errno));
- exit_message("info", 0, "Message server closed connection, "
- "simulation is exiting");
+ exitSimLoop("Message server closed connection, simulation "
+ "is exiting");
} else {
panic("send() failed: %s", strerror(errno));
}
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev