diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-30 00:39:49 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-03 00:16:46 +0000 |
commit | f6fda869ead3aae97e73d2222bfc9fdfd837491e (patch) | |
tree | 50b3364b03399c03b06c6a04122da327fb744104 /src/systemc/core/scheduler.cc | |
parent | 420ab42e02e2a7c0c5aace5b330717cc014bd178 (diff) | |
download | gem5-f6fda869ead3aae97e73d2222bfc9fdfd837491e.tar.xz |
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>
Diffstat (limited to 'src/systemc/core/scheduler.cc')
-rw-r--r-- | src/systemc/core/scheduler.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 46053b40f..9b431acba 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -201,6 +201,39 @@ Scheduler::ready(Process *p) } void +Scheduler::resume(Process *p) +{ + if (initDone) + ready(p); + else + initList.pushLast(p); +} + +bool +Scheduler::suspend(Process *p) +{ + if (initDone) { + // After initialization, the only list we can be on is the ready list. + bool was_ready = (p->nextListNode != nullptr); + p->popListNode(); + return was_ready; + } else { + bool was_ready = false; + // Check the ready list to see if we find this process. + ListNode *n = readyList.nextListNode; + while (n != &readyList) { + if (n == p) { + was_ready = true; + break; + } + } + if (was_ready) + toFinalize.pushLast(p); + return was_ready; + } +} + +void Scheduler::requestUpdate(Channel *c) { updateList.pushLast(c); |