changeset 57f9f8b8e62f in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=57f9f8b8e62f
description:
        cpu: provide a wakeup mechanism that can be used to pull CPUs out of 
sleep.
        Make interrupts use the new wakeup method, and pull all of the interrupt
        stuff into the cpu base class so that only the wakeup code needs to be 
updated.
        I tried to make wakeup, wakeCPU, and the various other mechanisms for 
waking
        and sleeping a little more sane, but I couldn't understand why the 
statistics
        were changing the way they were.  Maybe we'll try again some day.

diffstat:

8 files changed, 47 insertions(+), 47 deletions(-)
src/cpu/base.cc           |   18 ------------------
src/cpu/base.hh           |   23 ++++++++++++++++++++---
src/cpu/o3/cpu.cc         |   27 +++++++++++++++------------
src/cpu/o3/cpu.hh         |    7 ++++---
src/cpu/ozone/cpu.hh      |    2 +-
src/cpu/ozone/cpu_impl.hh |    4 +---
src/cpu/simple/base.cc    |   11 +++++------
src/cpu/simple/base.hh    |    2 +-

diffs (191 lines):

diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/base.cc
--- a/src/cpu/base.cc   Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/base.cc   Sat Jan 24 07:27:21 2009 -0800
@@ -390,24 +390,6 @@
 }
 
 void
-BaseCPU::postInterrupt(int int_num, int index)
-{
-    interrupts->post(int_num, index);
-}
-
-void
-BaseCPU::clearInterrupt(int int_num, int index)
-{
-    interrupts->clear(int_num, index);
-}
-
-void
-BaseCPU::clearInterrupts()
-{
-    interrupts->clearAll();
-}
-
-void
 BaseCPU::serialize(std::ostream &os)
 {
     SERIALIZE_SCALAR(instCnt);
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/base.hh
--- a/src/cpu/base.hh   Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/base.hh   Sat Jan 24 07:27:21 2009 -0800
@@ -125,9 +125,26 @@
         return interrupts;
     }
 
-    virtual void postInterrupt(int int_num, int index);
-    virtual void clearInterrupt(int int_num, int index);
-    virtual void clearInterrupts();
+    virtual void wakeup() = 0;
+
+    void
+    postInterrupt(int int_num, int index)
+    {
+        interrupts->post(int_num, index);
+        wakeup();
+    }
+
+    void
+    clearInterrupt(int int_num, int index)
+    {
+        interrupts->clear(int_num, index);
+    }
+
+    void
+    clearInterrupts()
+    {
+        interrupts->clearAll();
+    }
 
     bool
     checkInterrupts(ThreadContext *tc) const
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/o3/cpu.cc
--- a/src/cpu/o3/cpu.cc Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/o3/cpu.cc Sat Jan 24 07:27:21 2009 -0800
@@ -894,18 +894,6 @@
 
 #if FULL_SYSTEM
 template <class Impl>
-void
-FullO3CPU<Impl>::postInterrupt(int int_num, int index)
-{
-    BaseCPU::postInterrupt(int_num, index);
-
-    if (this->thread[0]->status() == ThreadContext::Suspended) {
-        DPRINTF(IPI,"Suspended Processor awoke\n");
-        this->threadContexts[0]->activate();
-    }
-}
-
-template <class Impl>
 Fault
 FullO3CPU<Impl>::hwrei(unsigned tid)
 {
@@ -1689,6 +1677,21 @@
     schedule(tickEvent, nextCycle());
 }
 
+#if FULL_SYSTEM
+template <class Impl>
+void
+FullO3CPU<Impl>::wakeup()
+{
+    if (this->thread[0]->status() != ThreadContext::Suspended)
+        return;
+
+    this->wakeCPU();
+
+    DPRINTF(Quiesce, "Suspended Processor woken\n");
+    this->threadContexts[0]->activate();
+}
+#endif
+
 template <class Impl>
 int
 FullO3CPU<Impl>::getFreeTid()
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/o3/cpu.hh
--- a/src/cpu/o3/cpu.hh Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/o3/cpu.hh Sat Jan 24 07:27:21 2009 -0800
@@ -402,9 +402,6 @@
     void trap(Fault fault, unsigned tid);
 
 #if FULL_SYSTEM
-    /** Posts an interrupt. */
-    void postInterrupt(int int_num, int index);
-
     /** HW return from error interrupt. */
     Fault hwrei(unsigned tid);
 
@@ -701,6 +698,10 @@
     /** Wakes the CPU, rescheduling the CPU if it's not already active. */
     void wakeCPU();
 
+#if FULL_SYSTEM
+    virtual void wakeup();
+#endif
+
     /** Gets a free thread id. Use if thread ids change across system. */
     int getFreeTid();
 
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/ozone/cpu.hh
--- a/src/cpu/ozone/cpu.hh      Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/ozone/cpu.hh      Sat Jan 24 07:27:21 2009 -0800
@@ -333,7 +333,7 @@
     Status _status;
 
   public:
-    void postInterrupt(int int_num, int index);
+    void wakeup();
 
     void zero_fill_64(Addr addr) {
         static int warned = 0;
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/ozone/cpu_impl.hh
--- a/src/cpu/ozone/cpu_impl.hh Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/ozone/cpu_impl.hh Sat Jan 24 07:27:21 2009 -0800
@@ -582,10 +582,8 @@
 #if FULL_SYSTEM
 template <class Impl>
 void
-OzoneCPU<Impl>::postInterrupt(int int_num, int index)
+OzoneCPU<Impl>::wakeup()
 {
-    BaseCPU::postInterrupt(int_num, index);
-
     if (_status == Idle) {
         DPRINTF(IPI,"Suspended Processor awoke\n");
 //      thread.activate();
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/simple/base.cc
--- a/src/cpu/simple/base.cc    Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/simple/base.cc    Sat Jan 24 07:27:21 2009 -0800
@@ -303,14 +303,13 @@
 
 #if FULL_SYSTEM
 void
-BaseSimpleCPU::postInterrupt(int int_num, int index)
+BaseSimpleCPU::wakeup()
 {
-    BaseCPU::postInterrupt(int_num, index);
+    if (thread->status() != ThreadContext::Suspended)
+        return;
 
-    if (thread->status() == ThreadContext::Suspended) {
-                DPRINTF(Quiesce,"Suspended Processor awoke\n");
-        thread->activate();
-    }
+    DPRINTF(Quiesce,"Suspended Processor awoke\n");
+    thread->activate();
 }
 #endif // FULL_SYSTEM
 
diff -r 130e19359857 -r 57f9f8b8e62f src/cpu/simple/base.hh
--- a/src/cpu/simple/base.hh    Fri Jan 23 17:19:48 2009 -0500
+++ b/src/cpu/simple/base.hh    Sat Jan 24 07:27:21 2009 -0800
@@ -98,7 +98,7 @@
     }
 
   public:
-    void postInterrupt(int int_num, int index);
+    void wakeup();
 
     void zero_fill_64(Addr addr) {
       static int warned = 0;
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to