systemc: Keep track of more cases when we should be ready after resume.
If a thread self suspends, it should be marked as ready after resuming. If a process was already ready when suspended, it should also be remarked as ready after resuming. Special care has to be taken in pre-initialization situations so that processes are put on the right lists, and whether a process is tracked is already marked as ready. Change-Id: I15da7d747db591785358d47781297468c5f9fd09 Reviewed-on: https://gem5-review.googlesource.com/c/12445 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
@@ -160,12 +160,16 @@ Process::suspend(bool inc_kids)
|
||||
|
||||
if (!_suspended) {
|
||||
_suspended = true;
|
||||
_suspendedReady = false;
|
||||
}
|
||||
_suspendedReady = scheduler.suspend(this);
|
||||
|
||||
if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
|
||||
scheduler.current() == this) {
|
||||
scheduler.yield();
|
||||
if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
|
||||
scheduler.current() == this) {
|
||||
// This isn't in the spec, but Accellera says that a thread that
|
||||
// self suspends should be marked ready immediately when it's
|
||||
// resumed.
|
||||
_suspendedReady = true;
|
||||
scheduler.yield();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +182,7 @@ Process::resume(bool inc_kids)
|
||||
if (_suspended) {
|
||||
_suspended = false;
|
||||
if (_suspendedReady)
|
||||
ready();
|
||||
scheduler.resume(this);
|
||||
_suspendedReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user