From ce1a137ddb283525e1417af5c2c58e612e7c1fa5 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 6 Oct 2022 16:07:01 +0200 Subject: [PATCH] Store NUMA core mapping in platform interface. --- repos/base-nova/src/core/include/platform.h | 5 +++++ repos/base-nova/src/core/platform.cc | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/repos/base-nova/src/core/include/platform.h b/repos/base-nova/src/core/include/platform.h index d992f32b40..975cb9d868 100644 --- a/repos/base-nova/src/core/include/platform.h +++ b/repos/base-nova/src/core/include/platform.h @@ -50,6 +50,7 @@ namespace Genode { /* map of virtual cpu ids in Genode to kernel cpu ids */ uint8_t map_cpu_ids[MAX_SUPPORTED_CPUS]; + uint8_t cpu_numa_map[MAX_SUPPORTED_CPUS]; addr_t _map_pages(addr_t phys_page, addr_t pages, bool guard_page = false); @@ -119,6 +120,10 @@ namespace Genode { unsigned pager_index(Affinity::Location location) const; unsigned kernel_cpu_id(Affinity::Location location) const; + unsigned domain_of_cpu(unsigned kernel_cpu_id) const { + return cpu_numa_map[kernel_cpu_id]; + } + Affinity::Location sanitize(Affinity::Location location) { return Affinity::Location(location.xpos() % _cpus.width(), location.ypos() % _cpus.height(), diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc index 77f51c9e56..5f3fd0f711 100644 --- a/repos/base-nova/src/core/platform.cc +++ b/repos/base-nova/src/core/platform.cc @@ -370,7 +370,7 @@ Platform::Platform() " vs ", sizeof(map_cpu_ids) / sizeof(map_cpu_ids[0])); nova_die(); } - if (!hip.remap_cpu_ids(map_cpu_ids, (unsigned)boot_cpu())) { + if (!hip.remap_cpu_ids(map_cpu_ids, cpu_numa_map, (unsigned)boot_cpu())) { error("re-ording cpu_id failed"); nova_die(); } @@ -405,6 +405,8 @@ Platform::Platform() size_t const num_mem_desc = (hip.hip_length - hip.mem_desc_offset) / hip.mem_desc_size; + log("HIP is ", hip.hip_length, " bytes long."); + addr_t mem_desc_base = ((addr_t)&hip + hip.mem_desc_offset); /* define core's virtual address space */ @@ -477,6 +479,7 @@ Platform::Platform() bool efi_boot = false; size_t kernel_memory = 0; + log("Found ", num_mem_desc, " memory entries in HIP"); /* * All "available" ram must be added to our physical allocator before all * non "available" regions that overlaps with ram get removed. @@ -497,7 +500,7 @@ Platform::Platform() uint64_t const base = mem_desc->addr; uint64_t const size = mem_desc->size; log("detected physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD), - " - size: ", Hex(size, Hex::PREFIX, Hex::PAD)); + " - size: ", Hex(size, Hex::PREFIX, Hex::PAD), " - node: ", mem_desc->domain, " type: ", static_cast(mem_desc->type)); } if (!mem_desc->size) continue; @@ -798,7 +801,7 @@ Platform::Platform() cpu->core, ":", cpu->thread); log(" remap (", location.xpos(), "x", location.ypos(),") -> ", - kernel_cpu_id, " - ", text, ") ", + kernel_cpu_id, " - ", text, " node: ", cpu->numa_id, ") ", boot_cpu() == kernel_cpu_id ? "boot cpu" : ""); }); }