changeset 91fbf7b7e933 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=91fbf7b7e933
description:
        kvm: Separate host frequency from simulated CPU frequency

        We used to use the KVM CPU's clock to specify the host frequency. This
        was not ideal for several reasons. One of them being that the clock
        parameter of a CPU determines the frequency of some of the components
        connected to the CPU. This changeset adds a separate hostFreq
        parameter that should be used to specify the host frequency until we
        add code to autodetect it. The hostFactor should still be used to
        specify the conversion factor between the host performance and that of
        the simulated system.

diffstat:

 src/cpu/kvm/BaseKvmCPU.py |  2 ++
 src/cpu/kvm/base.cc       |  8 ++++----
 src/cpu/kvm/base.hh       |  4 ++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r b9a742cdd75a -r 91fbf7b7e933 src/cpu/kvm/BaseKvmCPU.py
--- a/src/cpu/kvm/BaseKvmCPU.py Tue Jun 11 09:24:51 2013 +0200
+++ b/src/cpu/kvm/BaseKvmCPU.py Tue Jun 11 09:24:55 2013 +0200
@@ -71,4 +71,6 @@
     kvmVM = Param.KvmVM(Parent.any, 'KVM VM (i.e., shared memory domain)')
     useCoalescedMMIO = Param.Bool(False, "Use coalesced MMIO (EXPERIMENTAL)")
     usePerfOverflow = Param.Bool(False, "Use perf event overflow counters 
(EXPERIMENTAL)")
+
+    hostFreq = Param.Clock("2GHz", "Host clock frequency")
     hostFactor = Param.Float(1.0, "Cycle scale factor")
diff -r b9a742cdd75a -r 91fbf7b7e933 src/cpu/kvm/base.cc
--- a/src/cpu/kvm/base.cc       Tue Jun 11 09:24:51 2013 +0200
+++ b/src/cpu/kvm/base.cc       Tue Jun 11 09:24:55 2013 +0200
@@ -83,6 +83,7 @@
       pageSize(sysconf(_SC_PAGE_SIZE)),
       tickEvent(*this),
       perfControlledByTimer(params->usePerfOverflow),
+      hostFreq(params->hostFreq),
       hostFactor(params->hostFactor),
       drainManager(NULL),
       ctrInsts(0)
@@ -103,11 +104,11 @@
         runTimer.reset(new PerfKvmTimer(hwCycles,
                                         KVM_TIMER_SIGNAL,
                                         params->hostFactor,
-                                        params->clock));
+                                        params->hostFreq));
     else
         runTimer.reset(new PosixKvmTimer(KVM_TIMER_SIGNAL, CLOCK_MONOTONIC,
                                          params->hostFactor,
-                                         params->clock));
+                                         params->hostFreq));
 }
 
 BaseKvmCPU::~BaseKvmCPU()
@@ -410,8 +411,7 @@
     assert(_status == Idle);
     assert(!tickEvent.scheduled());
 
-    numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend)
-        * hostFactor;
+    numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend);
 
     schedule(tickEvent, clockEdge(delay));
     _status = Running;
diff -r b9a742cdd75a -r 91fbf7b7e933 src/cpu/kvm/base.hh
--- a/src/cpu/kvm/base.hh       Tue Jun 11 09:24:51 2013 +0200
+++ b/src/cpu/kvm/base.hh       Tue Jun 11 09:24:55 2013 +0200
@@ -670,6 +670,10 @@
      */
     std::unique_ptr<BaseKvmTimer> runTimer;
 
+    /** Host frequency */
+    Tick hostFreq;
+
+    /** Host factor as specified in the configuration */
     float hostFactor;
 
     /**
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to