arch: cpu: Track kernel stats using the base ISA agnostic type.
Then cast to the ISA specific type when necessary. This removes (mostly) an ISA specific aspect to some of the interfaces. The ISA specific version of the kernel stats still needs to be constructed and stored in a few places which means that kernel_stats.hh still needs to be a switching arch header, for instance. In the future, I'd like to make the kernel its own object like the Process objects in SE mode, and then it would be able to instantiate and maintain its own stats. Change-Id: I8309d49019124f6bea1482aaea5b5b34e8c97433 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18429 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -47,7 +47,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "arch/generic/tlb.hh"
|
||||
#include "arch/kernel_stats.hh"
|
||||
#include "arch/vtophys.hh"
|
||||
#include "cpu/base.hh"
|
||||
#include "cpu/simple_thread.hh"
|
||||
|
||||
@@ -52,10 +52,10 @@
|
||||
#include "debug/Checker.hh"
|
||||
|
||||
class EndQuiesceEvent;
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
};
|
||||
namespace TheISA {
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
};
|
||||
class Decoder;
|
||||
};
|
||||
|
||||
@@ -134,7 +134,7 @@ class CheckerThreadContext : public ThreadContext
|
||||
|
||||
System *getSystemPtr() override { return actualTC->getSystemPtr(); }
|
||||
|
||||
TheISA::Kernel::Statistics *
|
||||
::Kernel::Statistics *
|
||||
getKernelStats() override
|
||||
{
|
||||
return actualTC->getKernelStats();
|
||||
|
||||
@@ -925,7 +925,10 @@ FullO3CPU<Impl>::hwrei(ThreadID tid)
|
||||
// Need to clear the lock flag upon returning from an interrupt.
|
||||
this->setMiscRegNoEffect(AlphaISA::MISCREG_LOCKFLAG, false, tid);
|
||||
|
||||
this->thread[tid]->kernelStats->hwrei();
|
||||
auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
|
||||
this->thread[tid]->kernelStats);
|
||||
assert(stats);
|
||||
stats->hwrei();
|
||||
|
||||
// FIXME: XXX check for interrupts? XXX
|
||||
#endif
|
||||
@@ -937,9 +940,10 @@ bool
|
||||
FullO3CPU<Impl>::simPalCheck(int palFunc, ThreadID tid)
|
||||
{
|
||||
#if THE_ISA == ALPHA_ISA
|
||||
if (this->thread[tid]->kernelStats)
|
||||
this->thread[tid]->kernelStats->callpal(palFunc,
|
||||
this->threadContexts[tid]);
|
||||
auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
|
||||
this->thread[tid]->kernelStats);
|
||||
if (stats)
|
||||
stats->callpal(palFunc, this->threadContexts[tid]);
|
||||
|
||||
switch (palFunc) {
|
||||
case PAL::halt:
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "arch/isa_traits.hh"
|
||||
#include "arch/kernel_stats.hh"
|
||||
#include "arch/types.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "config/the_isa.hh"
|
||||
|
||||
@@ -119,7 +119,7 @@ class O3ThreadContext : public ThreadContext
|
||||
System *getSystemPtr() override { return cpu->system; }
|
||||
|
||||
/** Returns a pointer to this thread's kernel statistics. */
|
||||
TheISA::Kernel::Statistics *
|
||||
::Kernel::Statistics *
|
||||
getKernelStats() override
|
||||
{
|
||||
return thread->kernelStats;
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
|
||||
#include "cpu/simple/base.hh"
|
||||
|
||||
#include "arch/kernel_stats.hh"
|
||||
#include "arch/stacktrace.hh"
|
||||
#include "arch/utility.hh"
|
||||
#include "arch/vtophys.hh"
|
||||
|
||||
@@ -74,10 +74,8 @@ class CheckerCPU;
|
||||
class FunctionProfile;
|
||||
class ProfileNode;
|
||||
|
||||
namespace TheISA {
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
}
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +210,7 @@ class SimpleThread : public ThreadState, public ThreadContext
|
||||
|
||||
System *getSystemPtr() override { return system; }
|
||||
|
||||
TheISA::Kernel::Statistics *
|
||||
Kernel::Statistics *
|
||||
getKernelStats() override
|
||||
{
|
||||
return ThreadState::getKernelStats();
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "cpu/thread_context.hh"
|
||||
|
||||
#include "arch/generic/vec_pred_reg.hh"
|
||||
#include "arch/kernel_stats.hh"
|
||||
#include "base/logging.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "config/the_isa.hh"
|
||||
@@ -52,6 +51,7 @@
|
||||
#include "cpu/quiesce_event.hh"
|
||||
#include "debug/Context.hh"
|
||||
#include "debug/Quiesce.hh"
|
||||
#include "kern/kernel_stats.hh"
|
||||
#include "params/BaseCPU.hh"
|
||||
#include "sim/full_system.hh"
|
||||
|
||||
@@ -139,7 +139,7 @@ ThreadContext::quiesce()
|
||||
|
||||
suspend();
|
||||
if (getKernelStats())
|
||||
getKernelStats()->quiesce();
|
||||
getKernelStats()->quiesce();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,10 +70,8 @@ class FSTranslatingPortProxy;
|
||||
class PortProxy;
|
||||
class Process;
|
||||
class System;
|
||||
namespace TheISA {
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
}
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +148,7 @@ class ThreadContext
|
||||
|
||||
virtual System *getSystemPtr() = 0;
|
||||
|
||||
virtual TheISA::Kernel::Statistics *getKernelStats() = 0;
|
||||
virtual ::Kernel::Statistics *getKernelStats() = 0;
|
||||
|
||||
virtual PortProxy &getPhysProxy() = 0;
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
#include "cpu/thread_state.hh"
|
||||
|
||||
#include "arch/kernel_stats.hh"
|
||||
#include "base/output.hh"
|
||||
#include "cpu/base.hh"
|
||||
#include "cpu/profile.hh"
|
||||
#include "cpu/quiesce_event.hh"
|
||||
#include "kern/kernel_stats.hh"
|
||||
#include "mem/fs_translating_port_proxy.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
|
||||
@@ -41,10 +41,8 @@
|
||||
class EndQuiesceEvent;
|
||||
class FunctionProfile;
|
||||
class ProfileNode;
|
||||
namespace TheISA {
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
}
|
||||
namespace Kernel {
|
||||
class Statistics;
|
||||
}
|
||||
|
||||
class Checkpoint;
|
||||
@@ -98,7 +96,7 @@ struct ThreadState : public Serializable {
|
||||
|
||||
void profileSample();
|
||||
|
||||
TheISA::Kernel::Statistics *getKernelStats() { return kernelStats; }
|
||||
Kernel::Statistics *getKernelStats() { return kernelStats; }
|
||||
|
||||
PortProxy &getPhysProxy();
|
||||
|
||||
@@ -185,7 +183,7 @@ struct ThreadState : public Serializable {
|
||||
Addr profilePC;
|
||||
EndQuiesceEvent *quiesceEvent;
|
||||
|
||||
TheISA::Kernel::Statistics *kernelStats;
|
||||
Kernel::Statistics *kernelStats;
|
||||
|
||||
protected:
|
||||
Process *process;
|
||||
|
||||
Reference in New Issue
Block a user