diff options
author | Michael LeBeane <michael.lebeane@amd.com> | 2016-09-13 23:17:42 -0400 |
---|---|---|
committer | Michael LeBeane <michael.lebeane@amd.com> | 2016-09-13 23:17:42 -0400 |
commit | 458d4a3c7bff9365e9d732c56f105b5b7bd37739 (patch) | |
tree | 91c48b32127fc2ded18dfc6edf3b4077d3b021e4 /src/cpu/thread_context.cc | |
parent | 2068af5768fdd15acaf7a8bad766f7005f86e0c2 (diff) | |
download | gem5-458d4a3c7bff9365e9d732c56f105b5b7bd37739.tar.xz |
sim: Refactor quiesce and remove FS asserts
The quiesce family of magic ops can be simplified by the inclusion of
quiesceTick() and quiesce() functions on ThreadContext. This patch also
gets rid of the FS guards, since suspending a CPU is also a valid
operation for SE mode.
Diffstat (limited to 'src/cpu/thread_context.cc')
-rw-r--r-- | src/cpu/thread_context.cc | 36 |
1 files changed, 36 insertions, 0 deletions
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; |