From 3ae69d129003bfde426de223780b1e45ed6a5df3 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Sun, 18 Sep 2016 03:15:25 -0400 Subject: [PATCH] NUMA: process CPU NUMA information --- kernel/ap.c | 16 +++++++++++++--- kernel/mem.c | 2 +- lib/include/ihk/mm.h | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/kernel/ap.c b/kernel/ap.c index 73a709b3..349481c2 100644 --- a/kernel/ap.c +++ b/kernel/ap.c @@ -65,7 +65,7 @@ void ap_init(void) { struct ihk_mc_cpu_info *cpu_info; int i; - int bsp_hw_id; + int bsp_hw_id, bsp_cpu_id; ihk_mc_init_ap(); init_delay(); @@ -78,13 +78,23 @@ void ap_init(void) return; } - kprintf("BSP HW ID = %d\n", bsp_hw_id); + bsp_cpu_id = 0; + for (i = 0; i < cpu_info->ncpus; ++i) { + if (cpu_info->hw_ids[i] == bsp_hw_id) { + bsp_cpu_id = i; + break; + } + } + + kprintf("BSP: %d (HW ID: %d @ NUMA %d)\n", bsp_cpu_id, + bsp_hw_id, cpu_info->nodes[0]); for (i = 0; i < cpu_info->ncpus; i++) { if (cpu_info->hw_ids[i] == bsp_hw_id) { continue; } - kprintf("AP Booting: %d (HW ID: %d)\n", i, cpu_info->hw_ids[i]); + kprintf("AP Booting: %d (HW ID: %d @ NUMA %d)\n", i, + cpu_info->hw_ids[i], cpu_info->nodes[i]); ihk_mc_boot_cpu(cpu_info->hw_ids[i], (unsigned long)ap_wait); num_processors++; diff --git a/kernel/mem.c b/kernel/mem.c index 968548fe..72a8e0fa 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -501,7 +501,7 @@ static void numa_init(void) for (i = 0; i < ihk_mc_get_nr_numa_nodes(); ++i) { int linux_numa_id, type; - ihk_mc_get_numa_node(i, &linux_numa_id, &type); + ihk_mc_get_numa_node(i, &linux_numa_id, &type, NULL); memory_nodes[i].id = i; memory_nodes[i].linux_numa_id = linux_numa_id; memory_nodes[i].type = type; diff --git a/lib/include/ihk/mm.h b/lib/include/ihk/mm.h index 88265eab..8ddcad23 100644 --- a/lib/include/ihk/mm.h +++ b/lib/include/ihk/mm.h @@ -155,7 +155,9 @@ int ihk_mc_pt_virt_to_phys(struct page_table *pt, uint64_t ihk_mc_pt_virt_to_pagemap(struct page_table *pt, unsigned long virt); int ihk_mc_get_nr_numa_nodes(void); -int ihk_mc_get_numa_node(int id, int *linux_numa_id, int *type); +struct smp_coreset; +int ihk_mc_get_numa_node(int id, int *linux_numa_id, int *type, + struct smp_coreset **cpu_hw_ids); int ihk_mc_get_nr_memory_chunks(void); int ihk_mc_get_memory_chunk(int id, unsigned long *start,