From 989cc1735eb18f9894f91854acd28e9477fa3b60 Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Tue, 16 May 2006 13:51:18 -0400 Subject: [PATCH] Sampling fixes related to the quiesce event. cpu/cpu_exec_context.cc: cpu/cpu_exec_context.hh: Sampling fixes. The CPU models may switch during a quiesce period, so it needs to be sure to wake up the right XC. cpu/exec_context.hh: Return the EndQuiesceEvent specifically. sim/pseudo_inst.cc: Return the EndQuiesceEvent specifically for sampling. --HG-- extra : convert_revision : f9aa1fc8d4db8058f05319cb6a3d4605ce93b4c8 --- cpu/cpu_exec_context.cc | 10 ++++++++++ cpu/cpu_exec_context.hh | 4 ++-- cpu/exec_context.hh | 5 +++-- sim/pseudo_inst.cc | 5 +++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cpu/cpu_exec_context.cc b/cpu/cpu_exec_context.cc index e15ba7e66..3d047856a 100644 --- a/cpu/cpu_exec_context.cc +++ b/cpu/cpu_exec_context.cc @@ -159,6 +159,16 @@ CPUExecContext::takeOverFrom(ExecContext *oldContext) func_exe_inst = oldContext->readFuncExeInst(); #endif + EndQuiesceEvent *quiesce = oldContext->getQuiesceEvent(); + if (quiesce) { + // Point the quiesce event's XC at this XC so that it wakes up + // the proper CPU. + quiesce->xc = proxy; + } + if (quiesceEvent) { + quiesceEvent->xc = proxy; + } + storeCondFailures = 0; oldContext->setStatus(ExecContext::Unallocated); diff --git a/cpu/cpu_exec_context.hh b/cpu/cpu_exec_context.hh index 40153ff08..cac006925 100644 --- a/cpu/cpu_exec_context.hh +++ b/cpu/cpu_exec_context.hh @@ -135,9 +135,9 @@ class CPUExecContext Addr profilePC; void dumpFuncProfile(); - Event *quiesceEvent; + EndQuiesceEvent *quiesceEvent; - Event *getQuiesceEvent() { return quiesceEvent; } + EndQuiesceEvent *getQuiesceEvent() { return quiesceEvent; } Tick readLastActivate() { return lastActivate; } diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index 039b04527..7bd7d5682 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -42,6 +42,7 @@ class AlphaDTB; class AlphaITB; class BaseCPU; +class EndQuiesceEvent; class Event; class FunctionalMemory; class PhysicalMemory; @@ -130,7 +131,7 @@ class ExecContext virtual void unserialize(Checkpoint *cp, const std::string §ion) = 0; #if FULL_SYSTEM - virtual Event *getQuiesceEvent() = 0; + virtual EndQuiesceEvent *getQuiesceEvent() = 0; // Not necessarily the best location for these... // Having an extra function just to read these is obnoxious @@ -277,7 +278,7 @@ class ProxyExecContext : public ExecContext { actualXC->unserialize(cp, section); } #if FULL_SYSTEM - Event *getQuiesceEvent() { return actualXC->getQuiesceEvent(); } + EndQuiesceEvent *getQuiesceEvent() { return actualXC->getQuiesceEvent(); } Tick readLastActivate() { return actualXC->readLastActivate(); } Tick readLastSuspend() { return actualXC->readLastSuspend(); } diff --git a/sim/pseudo_inst.cc b/sim/pseudo_inst.cc index e475006e7..4d9541b58 100644 --- a/sim/pseudo_inst.cc +++ b/sim/pseudo_inst.cc @@ -38,6 +38,7 @@ #include "cpu/base.hh" #include "cpu/sampler/sampler.hh" #include "cpu/exec_context.hh" +#include "cpu/quiesce_event.hh" #include "kern/kernel_stats.hh" #include "sim/param.hh" #include "sim/serialize.hh" @@ -83,7 +84,7 @@ namespace AlphaPseudo if (!doQuiesce || ns == 0) return; - Event *quiesceEvent = xc->getQuiesceEvent(); + EndQuiesceEvent *quiesceEvent = xc->getQuiesceEvent(); if (quiesceEvent->scheduled()) quiesceEvent->reschedule(curTick + Clock::Int::ns * ns); @@ -100,7 +101,7 @@ namespace AlphaPseudo if (!doQuiesce || cycles == 0) return; - Event *quiesceEvent = xc->getQuiesceEvent(); + EndQuiesceEvent *quiesceEvent = xc->getQuiesceEvent(); if (quiesceEvent->scheduled()) quiesceEvent->reschedule(curTick +