Anthony Gutierrez has uploaded this change for review. ( https://gem5-review.googlesource.com/10461

Change subject: dev: Exit correctly in dist-gem5 for SE mode
......................................................................

dev: Exit correctly in dist-gem5 for SE mode

Do not allow the exit() syscall to terminate gem5 when running in dist-gem5
mode.  The exit must be coordinated by the distributed interface instead.

Change-Id: I57f47610b59fe9e18ba3a1667fb5e45cecac1a81
---
M src/sim/syscall_emul.cc
1 file changed, 15 insertions(+), 0 deletions(-)



diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 8736176..7f4d766 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -43,6 +43,7 @@
 #include "base/trace.hh"
 #include "config/the_isa.hh"
 #include "cpu/thread_context.hh"
+#include "dev/net/dist_iface.hh"
 #include "mem/page_table.hh"
 #include "sim/process.hh"
 #include "sim/sim_exit.hh"
@@ -102,6 +103,20 @@
     for (auto &system: sys->systemList)
         activeContexts += system->numRunningContexts();
     if (activeContexts == 1) {
+        /**
+ * Even though we are terminating the final thread context, dist-gem5
+         * requires the simulation to remain active and provide
+         * synchronization messages to the switch process. So we just halt
+         * the last thread context and return. The simulation will be
+         * terminated by dist-gem5 in a coordinated manner once all nodes
+         * have signaled their readiness to exit. For non dist-gem5
+         * simulations, readyToExit() always returns true.
+         */
+        if (!DistIface::readyToExit(0)) {
+            tc->halt();
+            return status;
+        }
+
exitSimLoop("exiting with last active thread context", status & 0xff);
         return status;
     }

--
To view, visit https://gem5-review.googlesource.com/10461
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I57f47610b59fe9e18ba3a1667fb5e45cecac1a81
Gerrit-Change-Number: 10461
Gerrit-PatchSet: 1
Gerrit-Owner: Anthony Gutierrez <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to