diff options
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/o3/cpu.cc | 7 | ||||
-rw-r--r-- | src/cpu/simple_thread.cc | 1 | ||||
-rw-r--r-- | src/cpu/thread_context.cc | 36 | ||||
-rw-r--r-- | src/cpu/thread_context.hh | 12 |
4 files changed, 52 insertions, 4 deletions
diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 73174e4a9..9bda09bf8 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -380,10 +380,9 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params) assert(o3_tc->cpu); o3_tc->thread = this->thread[tid]; - if (FullSystem) { - // Setup quiesce event. - this->thread[tid]->quiesceEvent = new EndQuiesceEvent(tc); - } + // Setup quiesce event. + this->thread[tid]->quiesceEvent = new EndQuiesceEvent(tc); + // Give the thread the TC. this->thread[tid]->tc = tc; diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index 33c5b47ea..0e17c07b5 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -69,6 +69,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, { clearArchRegs(); tc = new ProxyThreadContext<SimpleThread>(this); + quiesceEvent = new EndQuiesceEvent(tc); } SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, diff --git a/src/cpu/thread_context.cc b/src/cpu/thread_context.cc index 01ea51f26..691465996 100644 --- a/src/cpu/thread_context.cc +++ b/src/cpu/thread_context.cc @@ -41,6 +41,7 @@ * Authors: Kevin Lim */ +#include "arch/kernel_stats.hh" #include "base/misc.hh" #include "base/trace.hh" #include "config/the_isa.hh" @@ -48,6 +49,8 @@ #include "cpu/quiesce_event.hh" #include "cpu/thread_context.hh" #include "debug/Context.hh" +#include "debug/Quiesce.hh" +#include "params/BaseCPU.hh" #include "sim/full_system.hh" void @@ -104,6 +107,39 @@ ThreadContext::compare(ThreadContext *one, ThreadContext *two) } void +ThreadContext::quiesce() +{ + if (!getCpuPtr()->params()->do_quiesce) + return; + + DPRINTF(Quiesce, "%s: quiesce()\n", getCpuPtr()->name()); + + suspend(); + if (getKernelStats()) + getKernelStats()->quiesce(); +} + + +void +ThreadContext::quiesceTick(Tick resume) +{ + BaseCPU *cpu = getCpuPtr(); + + if (!cpu->params()->do_quiesce) + return; + + EndQuiesceEvent *quiesceEvent = getQuiesceEvent(); + + cpu->reschedule(quiesceEvent, resume, true); + + DPRINTF(Quiesce, "%s: quiesceTick until %lu\n", cpu->name(), resume); + + suspend(); + if (getKernelStats()) + getKernelStats()->quiesce(); +} + +void serialize(ThreadContext &tc, CheckpointOut &cp) { using namespace TheISA; diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh index 2544b19c6..f966c0aa1 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -174,6 +174,12 @@ class ThreadContext /// Set the status to Halted. virtual void halt() = 0; + /// Quiesce thread context + void quiesce(); + + /// Quiesce, suspend, and schedule activate at resume + void quiesceTick(Tick resume); + virtual void dumpFuncProfile() = 0; virtual void takeOverFrom(ThreadContext *old_context) = 0; @@ -367,6 +373,12 @@ class ProxyThreadContext : public ThreadContext /// Set the status to Halted. void halt() { actualTC->halt(); } + /// Quiesce thread context + void quiesce() { actualTC->quiesce(); } + + /// Quiesce, suspend, and schedule activate at resume + void quiesceTick(Tick resume) { actualTC->quiesceTick(resume); } + void dumpFuncProfile() { actualTC->dumpFuncProfile(); } void takeOverFrom(ThreadContext *oldContext) |