From 6a595fff0b57be1118561f1889f27f9619209dde Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 10 Sep 2024 11:45:24 +0200 Subject: [PATCH] Ensure the thread is ready before adding cpus --- src/rt/ovni.c | 4 ++-- test/emu/nosv/multiple-segment.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rt/ovni.c b/src/rt/ovni.c index 3c85692..dd19833 100644 --- a/src/rt/ovni.c +++ b/src/rt/ovni.c @@ -188,8 +188,8 @@ ovni_add_cpu(int index, int phyid) if (!rproc.ready) die("process not yet initialized"); - if (rproc.meta == NULL) - die("metadata not initialized"); + if (!rthread.ready) + die("thread not yet initialized"); struct ovni_rcpu *cpu = malloc(sizeof(*cpu)); if (cpu == NULL) diff --git a/test/emu/nosv/multiple-segment.c b/test/emu/nosv/multiple-segment.c index 3285fcb..ea037c5 100644 --- a/test/emu/nosv/multiple-segment.c +++ b/test/emu/nosv/multiple-segment.c @@ -27,10 +27,11 @@ main(void) int app = rank / N; char loom[128]; - if (snprintf(loom, 128, "loom.%04d", app) >= 128) + if (snprintf(loom, 128, "node0.%04d", app) >= 128) die("snprintf failed"); ovni_proc_init(1 + app, loom, getpid()); + ovni_thread_init(get_tid()); ovni_proc_set_rank(rank, nranks); /* Leader of the segment, must emit CPUs */ @@ -39,13 +40,13 @@ main(void) for (int i = 0; i < N; i++) { cpus[i] = app * N + i; ovni_add_cpu(i, cpus[i]); + info("adding cpu %d to rank %d", i, rank); } } int nlooms = nranks / N; int lcpu = rank % N; - ovni_thread_init(get_tid()); instr_require("ovni"); instr_nosv_init(); instr_thread_execute(lcpu, -1, 0);