diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2011-07-15 15:35:41 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-07-25 15:47:45 -0500 |
commit | b679a1729d7aea0870544e886ddb4b03e1ecf4c4 (patch) | |
tree | 8b945be92f740a9719a70465df5d8ceb635f5f95 /src/kernel/cpumgr.C | |
parent | ff7d0cf68fab49bb965467bcd9a6a8068e799349 (diff) | |
download | talos-hostboot-b679a1729d7aea0870544e886ddb4b03e1ecf4c4.tar.gz talos-hostboot-b679a1729d7aea0870544e886ddb4b03e1ecf4c4.zip |
Reduce working threads to first core.
This is required to reduce the memory footprint of the kernel
so we can fit within 2MB. This patch will cause (in simics)
all other cores/threads to execute a 'doze' instruction and
cease executing. In VBU, only 1 core will be active anyhow.
Change-Id: If1bdc01393b02d802ba7595a88dcf3331efc2d4e
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/203
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Diffstat (limited to 'src/kernel/cpumgr.C')
-rw-r--r-- | src/kernel/cpumgr.C | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/kernel/cpumgr.C b/src/kernel/cpumgr.C index 7be1cf2dc..fc421431e 100644 --- a/src/kernel/cpumgr.C +++ b/src/kernel/cpumgr.C @@ -1,3 +1,4 @@ +#include <assert.h> #include <kernel/cpumgr.H> #include <kernel/task.H> #include <kernel/cpu.H> @@ -9,6 +10,7 @@ #include <arch/ppc.H> #include <kernel/timemgr.H> #include <sys/sync.h> +#include <kernel/cpuid.H> cpu_t* CpuManager::cv_cpus[CpuManager::MAXCPUS] = { NULL }; bool CpuManager::cv_shutdown_requested = false; @@ -27,8 +29,36 @@ cpu_t* CpuManager::getCurrentCPU() void CpuManager::init() { - for (int i = 0; i < KERNEL_MAX_SUPPORTED_CPUS; i++) - Singleton<CpuManager>::instance().startCPU(i); + // For the initial boot we only want to set up CPU objects for the threads + // on this core. Otherwise we waste memory with kernel / idle task stacks. + // + // As long as the CPU object pointer is NULL, the start.S code won't + // enter the kernel, so we skip initializing all the other CPUs for now. + + // Determine number of threads on this core. + size_t threads = -1; + switch (getCpuType()) + { + case POWER7: + case POWER7_PLUS: + threads = 4; + break; + + case POWER8_VENICE: + case POWER8_SALERNO: + threads = 8; + break; + + case UNKNOWN: + default: + kassert(false); + break; + } + + // Create CPU objects starting at the thread-0 for this core. + size_t baseCpu = getPIR() & ~(threads-1); + for (size_t i = 0; i < threads; i++) + Singleton<CpuManager>::instance().startCPU(i + baseCpu); } void CpuManager::init_slave_smp(cpu_t* cpu) |