From 458d4a3c7bff9365e9d732c56f105b5b7bd37739 Mon Sep 17 00:00:00 2001 From: Michael LeBeane Date: Tue, 13 Sep 2016 23:17:42 -0400 Subject: 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. --- src/cpu/thread_context.cc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/cpu/thread_context.cc') 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 @@ -103,6 +106,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) { -- cgit v1.2.3