Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/12466
Change subject: systemc: When stopping immediately, block new
processes/updates.
......................................................................
systemc: When stopping immediately, block new processes/updates.
When stopping immediately, we're supposed to finish the current
process but not run any other processes or go to the update phase. The
rest of the process could introduce new processes or request new
updates, so we need to make sure we block those if we're in the process
of stopping.
Change-Id: I9cc867d294cf171dfedb4b9d43fbc167c2057de8
---
M src/systemc/core/scheduler.cc
M src/systemc/core/scheduler.hh
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index 8346ed4..5af76d9 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -44,7 +44,7 @@
stopEvent(this, false, StopPriority),
scMain(nullptr),
starvationEvent(this, false, StarvationPriority),
- _started(false), _paused(false), _stopped(false),
+ _started(false), _paused(false), _stopped(false), _stopNow(false),
maxTickEvent(this, false, MaxTickPriority),
_numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
runOnce(false)
@@ -189,6 +189,9 @@
void
Scheduler::ready(Process *p)
{
+ if (_stopNow)
+ return;
+
// Clump methods together to minimize context switching.
static bool cluster_methods = false;
@@ -276,6 +279,9 @@
_changeStamp++;
}
+ if (_stopNow)
+ return;
+
// The update phase.
update();
@@ -381,6 +387,7 @@
return;
if (!finish_delta) {
+ _stopNow = true;
// If we're not supposed to finish the delta cycle, flush all
// pending activity.
clear();
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index 7f28035..71464bb 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -386,6 +386,7 @@
bool _started;
bool _paused;
bool _stopped;
+ bool _stopNow;
Tick maxTick;
EventWrapper<Scheduler, &Scheduler::pause> maxTickEvent;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12466
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: I9cc867d294cf171dfedb4b9d43fbc167c2057de8
Gerrit-Change-Number: 12466
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev