From 503263a8a2a18539c0703e2c38b4120949bfde99 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 30 Jun 2015 13:19:01 +0200 Subject: [PATCH] base-nova: consider non-contiguous CPU numbers This is a follow-up commit to the following two patches: * base/nova: add idle threads to trace sources * nova: support to read thread and idle time --- repos/base-nova/src/core/platform.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc index 64c776e340..ddae6f7521 100644 --- a/repos/base-nova/src/core/platform.cc +++ b/repos/base-nova/src/core/platform.cc @@ -272,8 +272,8 @@ Platform::Platform() : } /* map idle SCs */ - unsigned const log2cpu = log2(hip->cpus()); - if ((1U << log2cpu) != hip->cpus()) { + unsigned const log2cpu = log2(hip->cpu_max()); + if ((1U << log2cpu) != hip->cpu_max()) { PERR("number of max CPUs is not of power of 2"); nova_die(); } @@ -289,7 +289,11 @@ Platform::Platform() : /* test reading out idle SCs */ bool sc_init = true; - for (unsigned i = 0; i < hip->cpus(); i++) { + for (unsigned i = 0; i < hip->cpu_max(); i++) { + + if (!hip->is_cpu_enabled(i)) + continue; + uint64_t n_time; uint8_t res = Nova::sc_ctrl(sc_idle_base + i, n_time); if (res != Nova::NOVA_OK) { @@ -635,7 +639,10 @@ Platform::Platform() : } /* add idle ECs to trace sources */ - for (unsigned i = 0; i < hip->cpus(); i++) { + for (unsigned i = 0; i < hip->cpu_max(); i++) { + + if (!hip->is_cpu_enabled(i)) + continue; struct Idle_trace_source : Trace::Source::Info_accessor, Trace::Control, Trace::Source @@ -665,7 +672,7 @@ Platform::Platform() : }; Idle_trace_source *source = new (core_mem_alloc()) - Idle_trace_source(Affinity::Location(i, 0, hip->cpus(), 1), + Idle_trace_source(Affinity::Location(i, 0, hip->cpu_max(), 1), sc_idle_base + i); Trace::sources().insert(source);