summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiacomo Travaglini <giacomo.travaglini@arm.com>2019-03-01 13:56:59 +0000
committerGiacomo Travaglini <giacomo.travaglini@arm.com>2019-05-14 08:44:37 +0000
commit27378ecbe40ea037c30f6790bfdc424ed64442b4 (patch)
tree7ce18c8f1e5d5c2450657a39570813f87c0c7063 /src
parent9a1eb7a3d21befaf7ded4fd7595418bde81d0a0b (diff)
downloadgem5-27378ecbe40ea037c30f6790bfdc424ed64442b4.tar.xz
Revert "cpu: fix how a thread starts up in MinorCPU"
This reverts commit 02dafc5498750d9734ba8f2a1608a846f90b71d1. The commit was part of a patchset which broke MinorCPU regressions (switcheroo) Change-Id: I0a8098fc71abe5838014e587dbe372b258d8aa9f Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18604 Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cpu/minor/cpu.cc46
-rw-r--r--src/cpu/minor/cpu.hh10
-rw-r--r--src/cpu/minor/execute.cc3
-rw-r--r--src/cpu/minor/fetch2.cc1
-rw-r--r--src/cpu/minor/fetch2.hh9
-rw-r--r--src/cpu/minor/pipeline.cc1
6 files changed, 16 insertions, 54 deletions
diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc
index 484457bd4..63efde2dc 100644
--- a/src/cpu/minor/cpu.cc
+++ b/src/cpu/minor/cpu.cc
@@ -49,7 +49,6 @@
MinorCPU::MinorCPU(MinorCPUParams *params) :
BaseCPU(params),
- pipelineStartupEvent([this]{ wakeupPipeline(); }, name()),
threadPolicy(params->threadPolicy)
{
/* This is only written for one thread at the moment */
@@ -280,43 +279,20 @@ MinorCPU::takeOverFrom(BaseCPU *old_cpu)
void
MinorCPU::activateContext(ThreadID thread_id)
{
- /* Remember to wake up this thread_id by scheduling the
- * pipelineStartup event.
- * We can't wakeupFetch the thread right away because its context may
- * not have been fully initialized. For example, in the case of clone
- * syscall, this activateContext function is called in the middle of
- * the syscall and before the new thread context is initialized.
- * If we start fetching right away, the new thread will fetch from an
- * invalid address (i.e., pc is not initialized yet), which could lead
- * to a page fault. Instead, we remember which threads to wake up and
- * schedule an event to wake all them up after their contexts are
- * fully initialized */
- readyThreads.push_back(thread_id);
- if (!pipelineStartupEvent.scheduled())
- schedule(pipelineStartupEvent, clockEdge(Cycles(0)));
-}
-
-void
-MinorCPU::wakeupPipeline()
-{
- for (auto thread_id : readyThreads) {
- DPRINTF(MinorCPU, "ActivateContext thread: %d\n", thread_id);
+ DPRINTF(MinorCPU, "ActivateContext thread: %d\n", thread_id);
- /* Do some cycle accounting. lastStopped is reset to stop the
- * wakeup call on the pipeline from adding the quiesce period
- * to BaseCPU::numCycles */
- stats.quiesceCycles += pipeline->cyclesSinceLastStopped();
- pipeline->resetLastStopped();
-
- /* Wake up the thread, wakeup the pipeline tick */
- threads[thread_id]->activate();
- wakeupOnEvent(Minor::Pipeline::CPUStageId);
+ /* Do some cycle accounting. lastStopped is reset to stop the
+ * wakeup call on the pipeline from adding the quiesce period
+ * to BaseCPU::numCycles */
+ stats.quiesceCycles += pipeline->cyclesSinceLastStopped();
+ pipeline->resetLastStopped();
- pipeline->wakeupFetch(thread_id);
- BaseCPU::activateContext(thread_id);
- }
+ /* Wake up the thread, wakeup the pipeline tick */
+ threads[thread_id]->activate();
+ wakeupOnEvent(Minor::Pipeline::CPUStageId);
+ pipeline->wakeupFetch(thread_id);
- readyThreads.clear();
+ BaseCPU::activateContext(thread_id);
}
void
diff --git a/src/cpu/minor/cpu.hh b/src/cpu/minor/cpu.hh
index 606a401b6..4e4762390 100644
--- a/src/cpu/minor/cpu.hh
+++ b/src/cpu/minor/cpu.hh
@@ -83,13 +83,6 @@ class MinorCPU : public BaseCPU
* Elements of pipeline call TheISA to implement the model. */
Minor::Pipeline *pipeline;
- /** An event that wakes up the pipeline when a thread context is
- * activated */
- EventFunctionWrapper pipelineStartupEvent;
-
- /** List of threads that are ready to wake up and run */
- std::vector<ThreadID> readyThreads;
-
public:
/** Activity recording for pipeline. This belongs to Pipeline but
* stages will access it through the CPU as the MinorCPU object
@@ -172,9 +165,6 @@ class MinorCPU : public BaseCPU
void activateContext(ThreadID thread_id) override;
void suspendContext(ThreadID thread_id) override;
- /** Wake up ready-to-run threads */
- void wakeupPipeline();
-
/** Thread scheduling utility functions */
std::vector<ThreadID> roundRobinPriority(ThreadID priority)
{
diff --git a/src/cpu/minor/execute.cc b/src/cpu/minor/execute.cc
index 81d310bba..810ff11c6 100644
--- a/src/cpu/minor/execute.cc
+++ b/src/cpu/minor/execute.cc
@@ -1061,8 +1061,7 @@ Execute::commit(ThreadID thread_id, bool only_commit_microops, bool discard,
!branch.isStreamChange() && /* No real branch */
fault == NoFault && /* No faults */
completed_inst && /* Still finding instructions to execute */
- num_insts_committed != commitLimit && /* Not reached commit limit */
- cpu.getContext(thread_id)->status() != ThreadContext::Suspended
+ num_insts_committed != commitLimit /* Not reached commit limit */
)
{
if (only_commit_microops) {
diff --git a/src/cpu/minor/fetch2.cc b/src/cpu/minor/fetch2.cc
index b374ee9bf..d60a1bab0 100644
--- a/src/cpu/minor/fetch2.cc
+++ b/src/cpu/minor/fetch2.cc
@@ -120,7 +120,6 @@ Fetch2::dumpAllInput(ThreadID tid)
popInput(tid);
fetchInfo[tid].inputIndex = 0;
- fetchInfo[tid].havePC = false;
}
void
diff --git a/src/cpu/minor/fetch2.hh b/src/cpu/minor/fetch2.hh
index 114dec0f5..ecd6a81ec 100644
--- a/src/cpu/minor/fetch2.hh
+++ b/src/cpu/minor/fetch2.hh
@@ -173,11 +173,6 @@ class Fetch2 : public Named
Stats::Scalar storeInstructions;
Stats::Scalar amoInstructions;
- public:
- /** Dump the whole contents of the input buffer. Useful after a
- * prediction changes control flow */
- void dumpAllInput(ThreadID tid);
-
protected:
/** Get a piece of data to work on from the inputBuffer, or 0 if there
* is no data. */
@@ -186,6 +181,10 @@ class Fetch2 : public Named
/** Pop an element off the input buffer, if there are any */
void popInput(ThreadID tid);
+ /** Dump the whole contents of the input buffer. Useful after a
+ * prediction changes control flow */
+ void dumpAllInput(ThreadID tid);
+
/** Update local branch prediction structures from feedback from
* Execute. */
void updateBranchPrediction(const BranchData &branch);
diff --git a/src/cpu/minor/pipeline.cc b/src/cpu/minor/pipeline.cc
index 3248d5465..b5659ac0d 100644
--- a/src/cpu/minor/pipeline.cc
+++ b/src/cpu/minor/pipeline.cc
@@ -199,7 +199,6 @@ void
Pipeline::wakeupFetch(ThreadID tid)
{
fetch1.wakeupFetch(tid);
- fetch2.dumpAllInput(tid);
}
bool