changeset e350ae2a5018 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=e350ae2a5018
description:
        inorder: add/remove halt/deallocate context respectively
        Halt is called from the exit() system call while
        deallocate is unused. So to clear up things, just
        use halt and remove deallocate.

diffstat:

3 files changed, 38 insertions(+), 49 deletions(-)
src/cpu/inorder/cpu.cc           |   65 +++++++++++++-------------------------
src/cpu/inorder/cpu.hh           |   15 +++++---
src/cpu/inorder/resource_pool.cc |    7 ++--

diffs (191 lines):

diff -r 8ae78a9733b0 -r e350ae2a5018 src/cpu/inorder/cpu.cc
--- a/src/cpu/inorder/cpu.cc    Sun Jan 31 18:27:58 2010 -0500
+++ b/src/cpu/inorder/cpu.cc    Sun Jan 31 18:28:05 2010 -0500
@@ -98,7 +98,7 @@
     "ActivateThread",
     "ActivateNextReadyThread",
     "DeactivateThread",
-    "DeallocateThread",
+    "HaltThread",
     "SuspendThread",
     "Trap",
     "InstGraduated",
@@ -123,8 +123,8 @@
         cpu->deactivateThread(tid);
         break;
 
-      case DeallocateThread:
-        cpu->deallocateThread(tid);
+      case HaltThread:
+        cpu->haltThread(tid);
         break;
 
       case SuspendThread: 
@@ -140,8 +140,7 @@
         break;
 
       default:
-        fatal("Unrecognized Event Type %d", cpuEventType);
-    
+        fatal("Unrecognized Event Type %s", eventNames[cpuEventType]);    
     }
     
     cpu->cpuEventRemoveList.push(this);
@@ -760,40 +759,6 @@
 }
 
 void
-InOrderCPU::deallocateContext(ThreadID tid, int delay)
-{
-    DPRINTF(InOrderCPU,"[tid:%i]: Deallocating ...\n", tid);
-
-    scheduleCpuEvent(DeallocateThread, NoFault, tid, dummyInst, delay);
-
-    // Be sure to signal that there's some activity so the CPU doesn't
-    // deschedule itself.
-    activityRec.activity();
-
-    _status = Running;
-}
-
-void
-InOrderCPU::deallocateThread(ThreadID tid)
-{
-    DPRINTF(InOrderCPU, "[tid:%i]: Calling deallocate thread.\n", tid);
-
-    if (isThreadActive(tid)) {
-        DPRINTF(InOrderCPU,"[tid:%i]: Removing from active threads list\n",
-                tid);
-        list<ThreadID>::iterator thread_it =
-            std::find(activeThreads.begin(), activeThreads.end(), tid);
-
-        removePipelineStalls(*thread_it);
-
-        activeThreads.erase(thread_it);
-    }
-
-    // TODO: "Un"Load/Unmap register file state
-  
-}
-
-void
 InOrderCPU::removePipelineStalls(ThreadID tid)
 {
     DPRINTF(InOrderCPU,"[tid:%i]: Removing all pipeline stalls\n",
@@ -874,20 +839,36 @@
 void
 InOrderCPU::haltContext(ThreadID tid, int delay)
 {
-    suspendContext(tid, delay);
+    DPRINTF(InOrderCPU, "[tid:%i]: Calling Halt Context...\n", tid);
+
+    scheduleCpuEvent(HaltThread, NoFault, tid, dummyInst, delay);
+
+    activityRec.activity();
+}
+
+void
+InOrderCPU::haltThread(ThreadID tid)
+{
+    DPRINTF(InOrderCPU, "[tid:%i]: Placing on Halted Threads List...\n", tid);
+    deactivateThread(tid);
+    squashThreadInPipeline(tid);   
+    haltedThreads.push_back(tid);    
+
+    if (threadModel == SwitchOnCacheMiss) {        
+        activateNextReadyContext();    
+    }
 }
 
 void
 InOrderCPU::suspendContext(ThreadID tid, int delay)
 {
     scheduleCpuEvent(SuspendThread, NoFault, tid, dummyInst, delay);
-    //_status = Idle;
 }
 
 void
 InOrderCPU::suspendThread(ThreadID tid)
 {
-    DPRINTF(InOrderCPU, "[tid: %i]: Placing on Suspended Threads List...\n", 
tid);
+    DPRINTF(InOrderCPU, "[tid:%i]: Placing on Suspended Threads List...\n", 
tid);
     deactivateThread(tid);
     suspendedThreads.push_back(tid);    
     thread[tid]->lastSuspend = curTick;    
diff -r 8ae78a9733b0 -r e350ae2a5018 src/cpu/inorder/cpu.hh
--- a/src/cpu/inorder/cpu.hh    Sun Jan 31 18:27:58 2010 -0500
+++ b/src/cpu/inorder/cpu.hh    Sun Jan 31 18:28:05 2010 -0500
@@ -177,7 +177,7 @@
         ActivateThread,
         ActivateNextReadyThread,
         DeactivateThread,
-        DeallocateThread,
+        HaltThread,
         SuspendThread,
         Trap,
         InstGraduated,
@@ -357,16 +357,18 @@
     void deactivateThread(ThreadID tid);
 
     /** Suspend Thread, Remove from Active Threads List, Add to Suspend List */
-    void haltContext(ThreadID tid, int delay = 0);
     void suspendContext(ThreadID tid, int delay = 0);
     void suspendThread(ThreadID tid);
 
-    /** Remove Thread from Active Threads List, Remove Any Loaded Thread State 
*/
-    void deallocateContext(ThreadID tid, int delay = 0);
-    void deallocateThread(ThreadID tid);
+    /** Halt Thread, Remove from Active Thread List, Place Thread on Halted 
+     *  Threads List 
+     */
+    void haltContext(ThreadID tid, int delay = 0);
+    void haltThread(ThreadID tid);
 
     /** squashFromMemStall() - sets up a squash event
      *  squashDueToMemStall() - squashes pipeline
+     *  @note: maybe squashContext/squashThread would be better?
      */
     void squashFromMemStall(DynInstPtr inst, ThreadID tid, int delay = 0);
     void squashDueToMemStall(int stage_num, InstSeqNum seq_num, ThreadID tid); 
   
@@ -587,6 +589,9 @@
     /** Suspended Threads List */
     std::list<ThreadID> suspendedThreads;
 
+    /** Halted Threads List */
+    std::list<ThreadID> haltedThreads;
+
     /** Thread Status Functions */
     bool isThreadActive(ThreadID tid);
     bool isThreadReady(ThreadID tid);
diff -r 8ae78a9733b0 -r e350ae2a5018 src/cpu/inorder/resource_pool.cc
--- a/src/cpu/inorder/resource_pool.cc  Sun Jan 31 18:27:58 2010 -0500
+++ b/src/cpu/inorder/resource_pool.cc  Sun Jan 31 18:28:05 2010 -0500
@@ -204,6 +204,9 @@
 //@todo: split this function and call this version schedulePoolEvent
 //       and use this scheduleEvent for scheduling a specific event on 
 //       a resource
+//@todo: For arguments that arent being used in a ResPoolEvent, a dummyParam
+//       or some typedef can be used to signify what's important info
+//       to the event construction
 void
 ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst,
                             int delay,  int res_idx, ThreadID tid)
@@ -229,8 +232,8 @@
         }
         break;
 
+      case InOrderCPU::HaltThread:
       case InOrderCPU::DeactivateThread:
-      case InOrderCPU::DeallocateThread:
         {
 
             DPRINTF(Resource, "Scheduling Deactivate Thread Resource Pool "
@@ -472,7 +475,7 @@
         break;
 
       case InOrderCPU::DeactivateThread:
-      case InOrderCPU::DeallocateThread:
+      case InOrderCPU::HaltThread:
         resPool->deactivateAll(tid);
         break;
 
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to