# HG changeset patch
# User Korey Sewell <[email protected]>
# Date 1254427253 14400
# Node ID 8c8a99403944fd46bc964800f6c0d6ef0ef37e25
# Parent  4d6c328347dba262318a88bb64198cd1fa3aee13
inorder: suspend in respool
give resources their own specific
activity to do for a "suspend" event
instead of defaulting to deactivating the thread for a
suspend thread event. This really matters
for the fetch sequence unit which wants to remove the
thread from fetching while other units want to
ignore a thread suspension. If you deactivate a thread
in a resource then you may lose some of the allotted
bandwidth that the thread is taking up...

diff --git a/src/cpu/inorder/resource.hh b/src/cpu/inorder/resource.hh
--- a/src/cpu/inorder/resource.hh
+++ b/src/cpu/inorder/resource.hh
@@ -91,6 +91,10 @@
      */
     virtual void deactivateThread(ThreadID tid);
 
+    /** Resources that care about thread activation override this. */
+    virtual void suspendThread(ThreadID tid) { }
+    
+
     /** Resources that care when an instruction has been graduated
      *  can override this
      */
diff --git a/src/cpu/inorder/resource_pool.cc b/src/cpu/inorder/resource_pool.cc
--- a/src/cpu/inorder/resource_pool.cc
+++ b/src/cpu/inorder/resource_pool.cc
@@ -204,7 +204,7 @@
         }
         break;
 
-      case InOrderCPU::SuspendThread:
+      case InOrderCPU::DeactivateThread:
       case InOrderCPU::DeallocateThread:
         {
 
@@ -222,6 +222,23 @@
         }
         break;
 
+      case InOrderCPU::SuspendThread:
+        {
+
+            DPRINTF(Resource, "Scheduling Suspend Thread Resource Pool Event 
for tick %i.\n",
+                    curTick + delay);
+            ResPoolEvent *res_pool_event = new ResPoolEvent(this,
+                                                            e_type,
+                                                            inst,
+                                                            
inst->squashingStage,
+                                                            inst->bdelaySeqNum,
+                                                            tid);
+
+            mainEventQueue.schedule(res_pool_event, curTick + 
cpu->ticks(delay));
+
+        }
+        break;
+
       case ResourcePool::InstGraduated:
         {
             DPRINTF(Resource, "Scheduling Inst-Graduated Resource Pool Event 
for tick %i.\n",
@@ -279,7 +296,8 @@
 ResourcePool::squashAll(DynInstPtr inst, int stage_num,
                         InstSeqNum done_seq_num, ThreadID tid)
 {
-    DPRINTF(Resource, "[tid:%i] Stage %i squashing all instructions above 
[sn:%i].\n",
+    DPRINTF(Resource, "[tid:%i] Broadcasting Squash All Event "
+            " starting w/stage %i for all instructions above [sn:%i].\n",
             tid, stage_num, done_seq_num);
 
     int num_resources = resources.size();
@@ -293,8 +311,9 @@
 ResourcePool::squashDueToMemStall(DynInstPtr inst, int stage_num,
                              InstSeqNum done_seq_num, ThreadID tid)
 {
-    DPRINTF(Resource, "[tid:%i] Stage %i squashing all instructions above 
[sn:%i].\n",
-            stage_num, tid, done_seq_num);
+    DPRINTF(Resource, "[tid:%i] Broadcasting SquashDueToMemStall Event"
+            " starting w/stage %i for all instructions above [sn:%i].\n",
+            tid, stage_num, done_seq_num);
 
     int num_resources = resources.size();
 
@@ -342,6 +361,19 @@
 }
 
 void
+ResourcePool::suspendAll(ThreadID tid)
+{
+    DPRINTF(Resource, "[tid:%i] Broadcasting Thread Suspension to all 
resources.\n",
+            tid);
+
+    int num_resources = resources.size();
+
+    for (int idx = 0; idx < num_resources; idx++) {
+        resources[idx]->suspendThread(tid);
+    }
+}
+
+void
 ResourcePool::instGraduated(InstSeqNum seq_num, ThreadID tid)
 {
     DPRINTF(Resource, "[tid:%i] Broadcasting [sn:%i] graduation to all 
resources.\n",
@@ -380,11 +412,15 @@
         resPool->activateAll(tid);
         break;
 
-      case InOrderCPU::SuspendThread:
+      case InOrderCPU::DeactivateThread:
       case InOrderCPU::DeallocateThread:
         resPool->deactivateAll(tid);
         break;
 
+      case InOrderCPU::SuspendThread:
+        resPool->suspendAll(tid);
+        break;
+
       case ResourcePool::InstGraduated:
         resPool->instGraduated(seqNum, tid);
         break;
diff --git a/src/cpu/inorder/resource_pool.hh b/src/cpu/inorder/resource_pool.hh
--- a/src/cpu/inorder/resource_pool.hh
+++ b/src/cpu/inorder/resource_pool.hh
@@ -172,6 +172,9 @@
     /** De-Activate Thread in all resources */
     void deactivateAll(ThreadID tid);
 
+    /** De-Activate Thread in all resources */
+    void suspendAll(ThreadID tid);
+
     /** Broadcast graduation to all resources */
     void instGraduated(InstSeqNum seq_num, ThreadID tid);
 
diff --git a/src/cpu/inorder/resources/cache_unit.cc 
b/src/cpu/inorder/resources/cache_unit.cc
--- a/src/cpu/inorder/resources/cache_unit.cc
+++ b/src/cpu/inorder/resources/cache_unit.cc
@@ -156,9 +156,9 @@
         return new_slot;
     } else {
         DPRINTF(InOrderCachePort,
-                "Denying request because there is an outstanding"
+                "[tid:%i] Denying request because there is an outstanding"
                 " request to/for addr. %08p. by [sn:%i] @ tick %i\n",
-                req_addr, addrMap[req_addr], inst->memTime);
+                inst->readTid(), req_addr, addrMap[req_addr], inst->memTime);
         return -1;
     }
 }
@@ -698,6 +698,13 @@
         cache_req->setMemAccPending(false);
         cache_req->setMemAccCompleted();
 
+        if (cache_req->isMemStall() && 
+            cpu->threadModel == InOrderCPU::SwitchOnCacheMiss) {    
+            DPRINTF(InOrderCachePort, "[tid:%u] Waking up from Cache Miss.\n");
+            
+            cpu->activateContext(tid);            
+        }
+        
         // Wake up the CPU (if it went to sleep and was waiting on this
         // completion event).
         cpu->wakeCPU();
@@ -779,6 +786,9 @@
     //       thread then you need to reevaluate this code
     // NOTE: squash should originate from 
     //       pipeline_stage.cc:processInstSchedule
+    DPRINTF(InOrderCachePort, "Squashing above [sn:%u]\n", 
+            squash_seq_num + 1);
+    
     squash(inst, stage_num, squash_seq_num + 1, tid);    
 }
 
diff --git a/src/cpu/inorder/resources/fetch_seq_unit.cc 
b/src/cpu/inorder/resources/fetch_seq_unit.cc
--- a/src/cpu/inorder/resources/fetch_seq_unit.cc
+++ b/src/cpu/inorder/resources/fetch_seq_unit.cc
@@ -335,3 +335,9 @@
     if (thread_it != cpu->fetchPriorityList.end())
         cpu->fetchPriorityList.erase(thread_it);
 }
+
+void
+FetchSeqUnit::suspendThread(ThreadID tid)
+{
+    deactivateThread(tid);    
+}
diff --git a/src/cpu/inorder/resources/fetch_seq_unit.hh 
b/src/cpu/inorder/resources/fetch_seq_unit.hh
--- a/src/cpu/inorder/resources/fetch_seq_unit.hh
+++ b/src/cpu/inorder/resources/fetch_seq_unit.hh
@@ -58,6 +58,7 @@
     virtual void init();
     virtual void activateThread(ThreadID tid);
     virtual void deactivateThread(ThreadID tid);
+    virtual void suspendThread(ThreadID tid);
     virtual void execute(int slot_num);
 
     /** Override default Resource squash sequence. This actually,
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to