diff options
author | Korey Sewell <ksewell@umich.edu> | 2010-01-31 18:28:05 -0500 |
---|---|---|
committer | Korey Sewell <ksewell@umich.edu> | 2010-01-31 18:28:05 -0500 |
commit | 5e0b8337ed9c8aa975cd44df5565c2c3dde0c267 (patch) | |
tree | 73fb7950d2c9068c09c9f803e9b3773fdb9a0530 /src/cpu/inorder | |
parent | 069b38c0d546708491d0da84668ba32f82ca7cb8 (diff) | |
download | gem5-5e0b8337ed9c8aa975cd44df5565c2c3dde0c267.tar.xz |
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 (limited to 'src/cpu/inorder')
-rw-r--r-- | src/cpu/inorder/cpu.cc | 65 | ||||
-rw-r--r-- | src/cpu/inorder/cpu.hh | 15 | ||||
-rw-r--r-- | src/cpu/inorder/resource_pool.cc | 7 |
3 files changed, 38 insertions, 49 deletions
diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index 8d41a18b4..5db86b258 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -98,7 +98,7 @@ std::string InOrderCPU::eventNames[NumCPUEvents] = "ActivateThread", "ActivateNextReadyThread", "DeactivateThread", - "DeallocateThread", + "HaltThread", "SuspendThread", "Trap", "InstGraduated", @@ -123,8 +123,8 @@ InOrderCPU::CPUEvent::process() cpu->deactivateThread(tid); break; - case DeallocateThread: - cpu->deallocateThread(tid); + case HaltThread: + cpu->haltThread(tid); break; case SuspendThread: @@ -140,8 +140,7 @@ InOrderCPU::CPUEvent::process() break; default: - fatal("Unrecognized Event Type %d", cpuEventType); - + fatal("Unrecognized Event Type %s", eventNames[cpuEventType]); } cpu->cpuEventRemoveList.push(this); @@ -760,40 +759,6 @@ InOrderCPU::deactivateThread(ThreadID tid) } 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 @@ InOrderCPU::activateNextReadyContext(int delay) 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 --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh index 1e514e1ed..70013c0f5 100644 --- a/src/cpu/inorder/cpu.hh +++ b/src/cpu/inorder/cpu.hh @@ -177,7 +177,7 @@ class InOrderCPU : public BaseCPU ActivateThread, ActivateNextReadyThread, DeactivateThread, - DeallocateThread, + HaltThread, SuspendThread, Trap, InstGraduated, @@ -357,16 +357,18 @@ class InOrderCPU : public BaseCPU 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 @@ class InOrderCPU : public BaseCPU /** 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 --git a/src/cpu/inorder/resource_pool.cc b/src/cpu/inorder/resource_pool.cc index 20f112a66..3750d18d6 100644 --- a/src/cpu/inorder/resource_pool.cc +++ b/src/cpu/inorder/resource_pool.cc @@ -204,6 +204,9 @@ ResourcePool::slotsInUse(int res_idx) //@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 @@ ResourcePool::scheduleEvent(InOrderCPU::CPUEventType e_type, DynInstPtr inst, } break; + case InOrderCPU::HaltThread: case InOrderCPU::DeactivateThread: - case InOrderCPU::DeallocateThread: { DPRINTF(Resource, "Scheduling Deactivate Thread Resource Pool " @@ -472,7 +475,7 @@ ResourcePool::ResPoolEvent::process() break; case InOrderCPU::DeactivateThread: - case InOrderCPU::DeallocateThread: + case InOrderCPU::HaltThread: resPool->deactivateAll(tid); break; |