From 52d521e4337995d417b6f7b68644959edcc0c6b4 Mon Sep 17 00:00:00 2001 From: Mitch Hayenga Date: Wed, 30 Sep 2015 11:14:19 -0500 Subject: cpu: Change thread assignments for heterogenous SMT Trying to run an SE system with varying threads per core (SMT cores + Non-SMT cores) caused failures due to the CPU id assignment logic. The comment about thread assignment (worrying about core 0 not having tid 0) seems not to be valid given that our configuration scripts initialize them in order. This removes that constraint so a heterogenously threaded sytem can work. --- src/cpu/base.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/cpu/base.cc') diff --git a/src/cpu/base.cc b/src/cpu/base.cc index eb5cadfcc..77ac5f2bb 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -436,21 +436,17 @@ BaseCPU::getMasterPort(const string &if_name, PortID idx) void BaseCPU::registerThreadContexts() { + assert(system->multiThread || numThreads == 1); + ThreadID size = threadContexts.size(); for (ThreadID tid = 0; tid < size; ++tid) { ThreadContext *tc = threadContexts[tid]; - /** This is so that contextId and cpuId match where there is a - * 1cpu:1context relationship. Otherwise, the order of registration - * could affect the assignment and cpu 1 could have context id 3, for - * example. We may even want to do something like this for SMT so that - * cpu 0 has the lowest thread contexts and cpu N has the highest, but - * I'll just do this for now - */ - if (numThreads == 1) - tc->setContextId(system->registerThreadContext(tc, _cpuId)); - else + if (system->multiThread) { tc->setContextId(system->registerThreadContext(tc)); + } else { + tc->setContextId(system->registerThreadContext(tc, _cpuId)); + } if (!FullSystem) tc->getProcessPtr()->assignThreadContext(tc->contextId()); -- cgit v1.2.3