summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2009-04-15 13:13:47 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2009-04-15 13:13:47 -0700
commit8882dc1283771463a20194c083f4b8940a2d574b (patch)
treed33aa3b7b59a4a466d43643e0b8bc64acc66e951 /src/cpu
parent9b66e8289781025bbc4d0e152737fa7c5d024ec8 (diff)
downloadgem5-8882dc1283771463a20194c083f4b8940a2d574b.tar.xz
Get rid of the Unallocated thread context state.
Basically merge it in with Halted. Also had to get rid of a few other functions that called ThreadContext::deallocate(), including: - InOrderCPU's setThreadRescheduleCondition. - ThreadContext::exit(). This function was there to avoid terminating simulation when one thread out of a multi-thread workload exits, but we need to find a better (non-cpu-centric) way.
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/checker/thread_context.hh3
-rw-r--r--src/cpu/inorder/cpu.hh6
-rw-r--r--src/cpu/inorder/inorder_dyn_inst.cc6
-rw-r--r--src/cpu/inorder/inorder_dyn_inst.hh2
-rw-r--r--src/cpu/inorder/thread_context.cc15
-rw-r--r--src/cpu/inorder/thread_context.hh29
-rwxr-xr-xsrc/cpu/o3/thread_context.hh19
-rwxr-xr-xsrc/cpu/o3/thread_context_impl.hh21
-rw-r--r--src/cpu/ozone/cpu.hh3
-rw-r--r--src/cpu/ozone/cpu_impl.hh10
-rw-r--r--src/cpu/simple/base.cc2
-rw-r--r--src/cpu/simple_thread.cc11
-rw-r--r--src/cpu/simple_thread.hh3
-rw-r--r--src/cpu/thread_context.hh13
14 files changed, 6 insertions, 137 deletions
diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh
index 6b21bf670..2176c597a 100644
--- a/src/cpu/checker/thread_context.hh
+++ b/src/cpu/checker/thread_context.hh
@@ -121,9 +121,6 @@ class CheckerThreadContext : public ThreadContext
/// Set the status to Suspended.
void suspend() { actualTC->suspend(); }
- /// Set the status to Unallocated.
- void deallocate(int delay = 0) { actualTC->deallocate(delay); }
-
/// Set the status to Halted.
void halt() { actualTC->halt(); }
diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
index f30ef128b..0545f4bf8 100644
--- a/src/cpu/inorder/cpu.hh
+++ b/src/cpu/inorder/cpu.hh
@@ -340,12 +340,6 @@ class InOrderCPU : public BaseCPU
virtual void disableMultiThreading(unsigned tid, unsigned vpe);
void disableThreads(unsigned tid, unsigned vpe);
- // Sets a thread-rescheduling condition.
- void setThreadRescheduleCondition(uint32_t tid)
- {
- //@TODO: IMPLEMENT ME
- }
-
/** Activate a Thread When CPU Resources are Available. */
void activateWhenReady(int tid);
diff --git a/src/cpu/inorder/inorder_dyn_inst.cc b/src/cpu/inorder/inorder_dyn_inst.cc
index ceb3cbe51..7fc953da2 100644
--- a/src/cpu/inorder/inorder_dyn_inst.cc
+++ b/src/cpu/inorder/inorder_dyn_inst.cc
@@ -573,12 +573,6 @@ InOrderDynInst::disableMultiThreading(unsigned vpe)
this->cpu->disableMultiThreading(threadNumber, vpe);
}
-void
-InOrderDynInst::setThreadRescheduleCondition(uint32_t cond)
-{
- this->cpu->setThreadRescheduleCondition(cond);
-}
-
template<class T>
inline Fault
InOrderDynInst::read(Addr addr, T &data, unsigned flags)
diff --git a/src/cpu/inorder/inorder_dyn_inst.hh b/src/cpu/inorder/inorder_dyn_inst.hh
index 55c61ffb9..3b47624fb 100644
--- a/src/cpu/inorder/inorder_dyn_inst.hh
+++ b/src/cpu/inorder/inorder_dyn_inst.hh
@@ -481,8 +481,6 @@ class InOrderDynInst : public FastAlloc, public RefCounted
virtual void enableMultiThreading(unsigned vpe);
virtual void disableMultiThreading(unsigned vpe);
- virtual void setThreadRescheduleCondition(uint32_t cond);
-
////////////////////////////////////////////////////////////
//
// PROGRAM COUNTERS - PC/NPC/NPC
diff --git a/src/cpu/inorder/thread_context.cc b/src/cpu/inorder/thread_context.cc
index 13f8ecdad..0cac51559 100644
--- a/src/cpu/inorder/thread_context.cc
+++ b/src/cpu/inorder/thread_context.cc
@@ -46,7 +46,7 @@ InOrderThreadContext::takeOverFrom(ThreadContext *old_context)
copyArchRegs(old_context);
thread->funcExeInst = old_context->readFuncExeInst();
- old_context->setStatus(ThreadContext::Unallocated);
+ old_context->setStatus(ThreadContext::Halted);
thread->inSyscall = false;
thread->trapPending = false;
}
@@ -80,19 +80,6 @@ InOrderThreadContext::suspend(int delay)
}
void
-InOrderThreadContext::deallocate(int delay)
-{
- DPRINTF(InOrderCPU, "Calling deallocate on Thread Context %d\n",
- getThreadNum());
-
- if (thread->status() == ThreadContext::Unallocated)
- return;
-
- thread->setStatus(ThreadContext::Unallocated);
- cpu->deallocateContext(thread->readTid(), delay);
-}
-
-void
InOrderThreadContext::halt(int delay)
{
DPRINTF(InOrderCPU, "Calling halt on Thread Context %d\n",
diff --git a/src/cpu/inorder/thread_context.hh b/src/cpu/inorder/thread_context.hh
index 3a1cb1379..ec8cc1979 100644
--- a/src/cpu/inorder/thread_context.hh
+++ b/src/cpu/inorder/thread_context.hh
@@ -118,9 +118,6 @@ class InOrderThreadContext : public ThreadContext
/** Set the status to Suspended. */
virtual void suspend(int delay = 0);
- /** Set the status to Unallocated. */
- virtual void deallocate(int delay = 1);
-
/** Set the status to Halted. */
virtual void halt(int delay = 0);
@@ -244,32 +241,6 @@ class InOrderThreadContext : public ThreadContext
virtual void changeRegFileContext(unsigned param,
unsigned val)
{ panic("Not supported!"); }
-
- /** This function exits the thread context in the CPU and returns
- * 1 if the CPU has no more active threads (meaning it's OK to exit);
- * Used in syscall-emulation mode when a thread executes the 'exit'
- * syscall.
- */
- virtual int exit()
- {
- this->deallocate();
-
- // If there are still threads executing in the system (for now
- // this single cpu)
- if (this->cpu->numActiveThreads() - 1 > 0)
- return 0; // don't exit simulation
- else
- return 1; // exit simulation
- }
-
- virtual void setThreadRescheduleCondition(uint64_t cond)
- {
- this->deallocate();
-
- this->setStatus(ThreadContext::Suspended);
-
- activateContext(cond);
- }
};
#endif
diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh
index c402e8fd9..e7c9c3b8f 100755
--- a/src/cpu/o3/thread_context.hh
+++ b/src/cpu/o3/thread_context.hh
@@ -122,9 +122,6 @@ class O3ThreadContext : public ThreadContext
/** Set the status to Suspended. */
virtual void suspend(int delay = 0);
- /** Set the status to Unallocated. */
- virtual void deallocate(int delay = 0);
-
/** Set the status to Halted. */
virtual void halt(int delay = 0);
@@ -273,22 +270,6 @@ class O3ThreadContext : public ThreadContext
#endif
this->cpu->setNextNPC(val, this->thread->threadId());
}
-
- /** This function exits the thread context in the CPU and returns
- * 1 if the CPU has no more active threads (meaning it's OK to exit);
- * Used in syscall-emulation mode when a thread executes the 'exit'
- * syscall.
- */
- virtual int exit()
- {
- this->deallocate();
-
- // If there are still threads executing in the system
- if (this->cpu->numActiveThreads())
- return 0; // don't exit simulation
- else
- return 1; // exit simulation
- }
};
#endif
diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh
index fc8b66b83..07140a19f 100755
--- a/src/cpu/o3/thread_context_impl.hh
+++ b/src/cpu/o3/thread_context_impl.hh
@@ -84,7 +84,7 @@ O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context)
cpu->lockFlag = false;
#endif
- old_context->setStatus(ThreadContext::Unallocated);
+ old_context->setStatus(ThreadContext::Halted);
thread->inSyscall = false;
thread->trapPending = false;
@@ -104,11 +104,6 @@ O3ThreadContext<Impl>::activate(int delay)
thread->lastActivate = curTick;
#endif
- if (thread->status() == ThreadContext::Unallocated) {
- cpu->activateWhenReady(thread->threadId());
- return;
- }
-
thread->setStatus(ThreadContext::Active);
// status() == Suspended
@@ -144,20 +139,6 @@ O3ThreadContext<Impl>::suspend(int delay)
template <class Impl>
void
-O3ThreadContext<Impl>::deallocate(int delay)
-{
- DPRINTF(O3CPU, "Calling deallocate on Thread Context %d delay %d\n",
- threadId(), delay);
-
- if (thread->status() == ThreadContext::Unallocated)
- return;
-
- thread->setStatus(ThreadContext::Unallocated);
- cpu->deallocateContext(thread->threadId(), true, delay);
-}
-
-template <class Impl>
-void
O3ThreadContext<Impl>::halt(int delay)
{
DPRINTF(O3CPU, "Calling halt on Thread Context %d\n",
diff --git a/src/cpu/ozone/cpu.hh b/src/cpu/ozone/cpu.hh
index af62f863a..2e21411ae 100644
--- a/src/cpu/ozone/cpu.hh
+++ b/src/cpu/ozone/cpu.hh
@@ -148,9 +148,6 @@ class OzoneCPU : public BaseCPU
/// Set the status to Suspended.
void suspend();
- /// Set the status to Unallocated.
- void deallocate(int delay = 0);
-
/// Set the status to Halted.
void halt();
diff --git a/src/cpu/ozone/cpu_impl.hh b/src/cpu/ozone/cpu_impl.hh
index aa76c8aa6..060ea6d78 100644
--- a/src/cpu/ozone/cpu_impl.hh
+++ b/src/cpu/ozone/cpu_impl.hh
@@ -737,14 +737,6 @@ OzoneCPU<Impl>::OzoneTC::suspend()
cpu->suspendContext(thread->threadId());
}
-/// Set the status to Unallocated.
-template <class Impl>
-void
-OzoneCPU<Impl>::OzoneTC::deallocate(int delay)
-{
- cpu->deallocateContext(thread->threadId(), delay);
-}
-
/// Set the status to Halted.
template <class Impl>
void
@@ -799,7 +791,7 @@ OzoneCPU<Impl>::OzoneTC::takeOverFrom(ThreadContext *old_context)
cpu->lockFlag = false;
#endif
- old_context->setStatus(ThreadContext::Unallocated);
+ old_context->setStatus(ThreadContext::Halted);
}
template <class Impl>
diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
index 348d2392f..71d26f828 100644
--- a/src/cpu/simple/base.cc
+++ b/src/cpu/simple/base.cc
@@ -81,7 +81,7 @@ BaseSimpleCPU::BaseSimpleCPU(BaseSimpleCPUParams *p)
p->itb, p->dtb, /* asid */ 0);
#endif // !FULL_SYSTEM
- thread->setStatus(ThreadContext::Unallocated);
+ thread->setStatus(ThreadContext::Halted);
tc = thread->getTC();
diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc
index 6ede3f429..73b23f89a 100644
--- a/src/cpu/simple_thread.cc
+++ b/src/cpu/simple_thread.cc
@@ -152,7 +152,7 @@ SimpleThread::takeOverFrom(ThreadContext *oldContext)
storeCondFailures = 0;
- oldContext->setStatus(ThreadContext::Unallocated);
+ oldContext->setStatus(ThreadContext::Halted);
}
void
@@ -253,15 +253,6 @@ SimpleThread::suspend()
cpu->suspendContext(_threadId);
}
-void
-SimpleThread::deallocate()
-{
- if (status() == ThreadContext::Unallocated)
- return;
-
- _status = ThreadContext::Unallocated;
- cpu->deallocateContext(_threadId);
-}
void
SimpleThread::halt()
diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh
index 5194a01ec..3daa55791 100644
--- a/src/cpu/simple_thread.hh
+++ b/src/cpu/simple_thread.hh
@@ -208,9 +208,6 @@ class SimpleThread : public ThreadState
/// Set the status to Suspended.
void suspend();
- /// Set the status to Unallocated.
- void deallocate();
-
/// Set the status to Halted.
void halt();
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh
index 72c9df33d..ca649b40e 100644
--- a/src/cpu/thread_context.hh
+++ b/src/cpu/thread_context.hh
@@ -87,14 +87,9 @@ class ThreadContext
typedef TheISA::MiscRegFile MiscRegFile;
typedef TheISA::MiscReg MiscReg;
public:
+
enum Status
{
- /// Initialized but not running yet. All CPUs start in
- /// this state, but most transition to Active on cycle 1.
- /// In MP or SMT systems, non-primary contexts will stay
- /// in this state until a thread is assigned to them.
- Unallocated,
-
/// Running. Instructions should be executed only when
/// the context is in this state.
Active,
@@ -154,9 +149,6 @@ class ThreadContext
/// Set the status to Suspended.
virtual void suspend(int delay = 0) = 0;
- /// Set the status to Unallocated.
- virtual void deallocate(int delay = 0) = 0;
-
/// Set the status to Halted.
virtual void halt(int delay = 0) = 0;
@@ -337,9 +329,6 @@ class ProxyThreadContext : public ThreadContext
/// Set the status to Suspended.
void suspend(int delay = 0) { actualTC->suspend(); }
- /// Set the status to Unallocated.
- void deallocate(int delay = 0) { actualTC->deallocate(); }
-
/// Set the status to Halted.
void halt(int delay = 0) { actualTC->halt(); }