summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2010-01-31 18:26:47 -0500
committerKorey Sewell <ksewell@umich.edu>2010-01-31 18:26:47 -0500
commit96b493d3159f7e94b8e53edbe562e28076f2af95 (patch)
tree9883633386e989fb52742dced10db44bece80020 /src
parentd9eaa2fe2149528e109b8b32a00dd4fa72d8ec4f (diff)
downloadgem5-96b493d3159f7e94b8e53edbe562e28076f2af95.tar.xz
inorder: ready/suspend status fns
update/add in the use of isThreadReady & isThreadSuspended functions.Check in activateThread what list a thread is on so it can be managed accordingly.
Diffstat (limited to 'src')
-rw-r--r--src/cpu/inorder/cpu.cc56
-rw-r--r--src/cpu/inorder/cpu.hh1
2 files changed, 41 insertions, 16 deletions
diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc
index 954309a74..ec6bb21ee 100644
--- a/src/cpu/inorder/cpu.cc
+++ b/src/cpu/inorder/cpu.cc
@@ -628,7 +628,7 @@ InOrderCPU::scheduleCpuEvent(CPUEventType c_event, Fault fault,
resPool->scheduleEvent(c_event, inst, 0, 0, tid);
}
-inline bool
+bool
InOrderCPU::isThreadActive(ThreadID tid)
{
list<ThreadID>::iterator isActive =
@@ -637,6 +637,23 @@ InOrderCPU::isThreadActive(ThreadID tid)
return (isActive != activeThreads.end());
}
+bool
+InOrderCPU::isThreadReady(ThreadID tid)
+{
+ list<ThreadID>::iterator isReady =
+ std::find(readyThreads.begin(), readyThreads.end(), tid);
+
+ return (isReady != readyThreads.end());
+}
+
+bool
+InOrderCPU::isThreadSuspended(ThreadID tid)
+{
+ list<ThreadID>::iterator isSuspended =
+ std::find(suspendedThreads.begin(), suspendedThreads.end(), tid);
+
+ return (isSuspended != suspendedThreads.end());
+}
void
InOrderCPU::activateNextReadyThread()
@@ -655,26 +672,40 @@ InOrderCPU::activateNextReadyThread()
readyThreads.erase(ready_it);
} else {
DPRINTF(InOrderCPU,
- "No Ready Threads to Activate.\n");
+ "Attempting to activate new thread, but No Ready Threads to"
+ "activate.\n");
}
}
void
InOrderCPU::activateThread(ThreadID tid)
{
+ if (isThreadSuspended(tid)) {
+ DPRINTF(InOrderCPU,
+ "Removing [tid:%i] from suspended threads list.\n", tid);
+
+ list<ThreadID>::iterator susp_it =
+ std::find(suspendedThreads.begin(), suspendedThreads.end(),
+ tid);
+ suspendedThreads.erase(susp_it);
+ }
+
if (threadModel == SwitchOnCacheMiss &&
numActiveThreads() == 1) {
DPRINTF(InOrderCPU,
- "Ignoring Activation of [tid:%i]. Placing on "
- "ready list\n", tid);
+ "Ignoring activation of [tid:%i], since [tid:%i] is "
+ "already running.\n", tid, activeThreadId());
+
+ DPRINTF(InOrderCPU,"Placing [tid:%i] ready threads list\n",
+ tid);
readyThreads.push_back(tid);
- } else if (!isThreadActive(tid)) {
+ } else if (!isThreadActive(tid)) {
DPRINTF(InOrderCPU,
- "Adding Thread %i to active threads list in CPU.\n", tid);
+ "Adding [tid:%i] to active threads list.\n", tid);
activeThreads.push_back(tid);
-
+
wakeCPU();
}
}
@@ -710,6 +741,8 @@ InOrderCPU::deactivateThread(ThreadID tid)
activeThreads.erase(thread_it);
}
+
+ assert(!isThreadActive(tid));
}
void
@@ -758,15 +791,6 @@ InOrderCPU::removePipelineStalls(ThreadID tid)
}
-bool
-InOrderCPU::isThreadSuspended(ThreadID tid)
-{
- list<ThreadID>::iterator isSuspended =
- std::find(suspendedThreads.begin(), suspendedThreads.end(), tid);
-
- return (isSuspended!= suspendedThreads.end());
-}
-
void
InOrderCPU::updateThreadPriority()
{
diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
index c31481421..f4f7cb390 100644
--- a/src/cpu/inorder/cpu.hh
+++ b/src/cpu/inorder/cpu.hh
@@ -588,6 +588,7 @@ class InOrderCPU : public BaseCPU
/** Thread Status Functions */
bool isThreadActive(ThreadID tid);
+ bool isThreadReady(ThreadID tid);
bool isThreadSuspended(ThreadID tid);
private: